Skip to content

Commit

Permalink
feat: prebuilt browser bundles
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Marcin Rataj <[email protected]>
  • Loading branch information
lidel committed Apr 22, 2020
1 parent cac51fa commit bc1c63d
Show file tree
Hide file tree
Showing 4 changed files with 20,430 additions and 4,769 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,5 @@ typings/

# next.js build output
.next

dist
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,36 @@

## Install

### via NPM

```console
$ npm install ipfs-provider
```

### via prebuilt browser bundles

```html
<!-- remember to include js-ipfs and js-ipfs-http-client, if they are used -->
<script src="https://cdn.jsdelivr.net/npm/ipfs/dist/index.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/ipfs-http-client/dist/index.min.js"></script>

<!-- prebuilt and minified bundle -->
<script src="https://cdn.jsdelivr.net/npm/ipfs-provider/dist/index.min.js"></script>

<script>
const { getIpfs, providers } = window.IpfsProvider
const { ipfs, provider, apiAddress } = await getIpfs({
loadHttpClientModule: () => window.IpfsHttpClient,
loadJsIpfsModule: () => window.Ipfs,
providers: [ /* see Usage below */ ]
})
</script>
```

**Note:** when using prebuilt bundles in production use explicit versions and SRI hashes.
Details [here](https://github.com/ipfs/js-ipfs/tree/master/packages/ipfs-http-client#in-a-web-browser).
<!-- TODO: add prebuild+versions+sri example to ./examples -->

## Usage

```js
Expand Down
Loading

0 comments on commit bc1c63d

Please sign in to comment.