frontend-path

1.0.0 • Public • Published

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 browserpath

How to use

As I said, the same NodeJS API

Readme

Keywords

none

Package Sidebar

Install

npm i frontend-path

Weekly Downloads

0

Version

1.0.0

License

none

Unpacked Size

46.1 kB

Total Files

16

Last publish

Collaborators

  • g4rcez