@acce/lit-path

This is a simple project to implement node.js path API into a browser, as cleanly as possible.

Usage no npm install needed!

<script type="module">
  import acceLitPath from 'https://cdn.skypack.dev/@acce/lit-path';
</script>

README

Lit Paths

This is a simple project to implement node.js path API into a browser, as cleanly as possible.

install

npm i -S @acce/lit-path

use

import * as path from '@acce/lit-path';

path.dirname('/test/directory.ext'); //> "/test"

or

import { basename } from '@acce/lit-path';

path.basename('/test/directory.ext', '.ext'); //> "directory"

Supported APIs

This implements near 1-1 code with node.js path API.

Here are the implemented APIs

  • path.basename
  • path.dirname
  • path.extname
  • path.normalize
  • path.join
  • path.resolve
  • path.parse
  • path.format

differences

  • process.cwd() is assumed to be the location.pathname
  • path format is always posix, because the web...