Skip to content

Commit e81d348

Browse files
committed
add install docs to readme
1 parent 515f077 commit e81d348

File tree

1 file changed

+35
-2
lines changed

1 file changed

+35
-2
lines changed

README.md

+35-2
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,43 @@ IPFS repo exposes a well defined interface by the Repo Spec. Each of the individ
5050
- The blocks folder is the current version of datastore.
5151
- The keys repo doesn't exist yet, as the private key is simply stored inside config
5252

53-
## Usage
53+
# Installation
54+
55+
## npm
56+
57+
```sh
58+
> npm i ipfs-repo
59+
```
60+
61+
## Use in Node.js
62+
63+
```JavaScript
64+
var IPFSRepo = require('ipfs-repo')
65+
```
66+
67+
## Use in a browser with browserify, webpack or any other bundler
68+
69+
The code published to npm that gets loaded on require is in fact a ES5 transpiled version with the right shims added. This means that you can require it and use with your favourite bundler without having to adjust asset management process.
70+
71+
```JavaScript
72+
var IPFSRepo = require('ipfs-repo')
73+
```
74+
75+
## Use in a browser Using a script tag
76+
77+
Loading this module through a script tag will make the `Unixfs` obj available in the global namespace.
78+
79+
```html
80+
<script src="https://npmcdn.com/ipfs-repo/dist/index.min.js"></script>
81+
<!-- OR -->
82+
<script src="https://npmcdn.com/ipfs-repo/dist/index.js"></script>
83+
```
84+
85+
86+
# Usage
5487

5588
```js
56-
var blobStore = require('abstract-blob-store') // an in-memory blob store
89+
var fsBlobStore = require('fs-blob-store') // an in-memory blob store
5790
var IPFSRepo = require('js-ipfs-repo')
5891
var repo = new IPFSRepo('/Users/someone/.ipfs', {
5992
stores: blobStore

0 commit comments

Comments
 (0)