Skip to content
This repository was archived by the owner on Feb 12, 2024. It is now read-only.

Commit 9fac289

Browse files
committed
docs: fix incorrect description in custom repo example
automatically stop the node in the custom repo example docs: update custom repo example
1 parent 1c23edc commit 9fac289

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

examples/custom-ipfs-repo/README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ This example shows you how to customize your repository, including where your da
55
* If you want to store data somewhere that’s not on your local disk, like S3, a Redis instance, a different machine on your local network, or in your own database system, like MongoDB or Postgres, you might use a custom datastore.
66
* If you have multiple browser windows or workers sharing the same IPFS storage, you might want to use a custom lock to coordinate between them. (Locking is currently only used to ensure a single IPFS instance can access a repo at a time. This check is done on `repo.open()`. A more complex lock, coupled with a custom datastore, could allow for safe writes to a single datastore from multiple IPFS nodes.)
77

8-
98
You can find full details on customization in the [IPFS Repo Docs](https://github.com/ipfs/js-ipfs-repo#setup).
109

1110
## Run this example
@@ -18,7 +17,7 @@ You can find full details on customization in the [IPFS Repo Docs](https://githu
1817
## Other Options
1918

2019
### Custom Repo Lock
21-
This example sets the repo locker to `false`, preventing any locking from happening. If you would like to control how locking happens, such as with a centralized S3 IPFS Repo, you can pass in your own custom lock. See [custom-lock.js](./custom-lock.js) for an example of a custom lock that can be used for [datastore-s3](https://github.com/ipfs/js-datastore-s3).
20+
This example uses one of the locks that comes with IPFS Repo. If you would like to control how locking happens, such as with a centralized S3 IPFS Repo, you can pass in your own custom lock. See [custom-lock.js](./custom-lock.js) for an example of a custom lock that can be used for [datastore-s3](https://github.com/ipfs/js-datastore-s3).
2221

2322
```js
2423
const S3Lock = require('./custom-lock')

examples/custom-ipfs-repo/index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,4 +90,10 @@ node.on('ready', () => {
9090
.catch((err) => {
9191
console.log('File Processing Error:', err)
9292
})
93+
// After everything is done, shut the node down
94+
// We don't need to worry about catching errors here
95+
.then(() => {
96+
console.log('\n\nStopping the node')
97+
return node.stop()
98+
})
9399
})

0 commit comments

Comments
 (0)