Skip to content

doc: Update README.md to reflect current API #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 9, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,32 @@ This implements the Node.js [`path`][path] module for environments that do not h

## Install

You usually do not have to install `path-browserify` yourself! If your code runs in Node.js, `path` is built in. If your code runs in the browser, bundlers like [browserify](https://github.com/browserify/browserify) or [webpack](https://github.com/webpack/webpack) include the `path-browserify` module by default.

But if none of those apply, with npm do:

```
npm install path-browserify
npm install @isomorphic-git/path-browserify
```

## Usage

```javascript
var path = require('path')
import path from '@isomorphic-git/path-browserify';

var filename = 'logo.png';
var logo = path.join('./assets/img', filename);
const filename = 'logo.png';
const logo = path.join('./assets/img', filename);
document.querySelector('#logo').src = logo;
```

Methods under `path` can be imported individually.

```javascript
import { join } from '@isomorphic-git/path-browserify';
```

If your project uses CommonJS, this is also supported.

```javascript
const path = require('@isomorphic-git/path-browserify');
```

## API

See the [Node.js path docs][path]. `path-browserify` currently matches the Node.js 10.3 API.
Expand Down