The
path
module from Node.js for browsers
-
forked from path-browserify , and combined with @types/path-browserify
-
converted to ES6 Modules (ESM)
-
added new method: path.setCWD(path: string)
The original path-browserify would fail when calling resolve in browser, as it calls process.cwd() internally. Now, the CWD can be manually set (default is empty string) -
path.process_cwd:string get the current CWD
/ path-browserify-esm / index.esm.js
npm install path-browserify-esm
Via jsDelivr:
<script src="https://cdn.jsdelivr.net/npm/path-browserify-esm/index.esm.js" type="module"></script>
<script type="module">
import path from 'https://cdn.jsdelivr.net/npm/path-browserify-esm/index.esm.js';
console.log(path.join('asd','zxc','../qwe/rty')); //asd/qwe/rty
path.setCWD('http://192.168.1.1')
console.log(path.resolve('asd','zxc','../qwe/rty')); //http:/192.168.1.1/asd/qwe/rty
</script>