1.0.0 • Published 6 years ago
frontend-path v1.0.0
browserpath
The same of NodeJS path, maybe resolve function (win32 and posix) doesn't work as expect.
This functions require process.cwd() and browser doesn't have. To try to fix this:
const app = navigator.appVersion;
const isWindows = app.indexOf("Win") != -1;
const isUnix = app.indexOf("X11") != -1 || app.indexOf("Linux") != -1 || app.indexOf("Mac") != -1;
// If is unix based, use the root path
// If windows, try to use the most common root path
const processCwdEmulate = isUnix ? "/" : isWindows ? "c:\\" : "";Install
Simple
npm i browserpath
yarn add browserpathHow to use
As I said, the same NodeJS API
1.0.0
6 years ago