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

fix: add missing dep #59

Merged
merged 3 commits into from
Sep 30, 2021
Merged
Show file tree
Hide file tree
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: 10 additions & 14 deletions examples/custom-ipfs-repo/index.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
'use strict'

const { create } = require('ipfs-core')
const {
createRepo,
locks: {
fs: fsLock
}
} = require('ipfs-repo')
const { createRepo } = require('ipfs-repo')
const FSLock = require('ipfs-repo/locks/fs')
const all = require('it-all')
const { fromString: uint8ArrayFromString } = require('uint8arrays/from-string')
const { concat: uint8ArrayConcat } = require('uint8arrays/concat')
const DatastoreFS = require('datastore-fs')
const BlockstoreDatastoreAdapter = require('blockstore-datastore-adapter')
const { FsDatastore } = require('datastore-fs')
const { BlockstoreDatastoreAdapter } = require('blockstore-datastore-adapter')

// multiformat codecs to support
const codecs = [
Expand Down Expand Up @@ -46,31 +42,31 @@ async function main () {
* you could store your keys in a levelDB database while everything else is in files.
* See https://www.npmjs.com/package/interface-datastore for more about datastores.
*/
root: new DatastoreFS(path, {
root: new FsDatastore(path, {
extension: '.ipfsroot', // Defaults to '', appended to all files
errorIfExists: false, // If the datastore exists, don't throw an error
createIfMissing: true // If the datastore doesn't exist yet, create it
}),
// blocks is a blockstore, all other backends are datastores - but we can wrap a datastore
// in an adapter to turn it into a blockstore
blocks: new BlockstoreDatastoreAdapter(
new DatastoreFS(`${path}/blocks`, {
new FsDatastore(`${path}/blocks`, {
extension: '.ipfsblock',
errorIfExists: false,
createIfMissing: true
})
),
keys: new DatastoreFS(`${path}/keys`, {
keys: new FsDatastore(`${path}/keys`, {
extension: '.ipfskey',
errorIfExists: false,
createIfMissing: true
}),
datastore: new DatastoreFS(`${path}/datastore`, {
datastore: new FsDatastore(`${path}/datastore`, {
extension: '.ipfsds',
errorIfExists: false,
createIfMissing: true
}),
pins: new DatastoreFS(`${path}/pins`, {
pins: new FsDatastore(`${path}/pins`, {
extension: '.ipfspin',
errorIfExists: false,
createIfMissing: true
Expand All @@ -80,7 +76,7 @@ async function main () {
* A custom lock can be added here. Or the build in Repo `fs` or `memory` locks can be used.
* See https://github.com/ipfs/js-ipfs-repo for more details on setting the lock.
*/
lock: fsLock
lock: FSLock
}),

// This just means we dont try to connect to the network which isn't necessary
Expand Down
8 changes: 4 additions & 4 deletions examples/custom-ipfs-repo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
"dependencies": {
"@ipld/dag-cbor": "^6.0.5",
"@ipld/dag-pb": "^2.1.3",
"blockstore-datastore-adapter": "^1.0.0",
"datastore-fs": "^5.0.2",
"ipfs": "^0.59.0",
"ipfs-repo": "^12.0.0",
"blockstore-datastore-adapter": "^2.0.3",
"datastore-fs": "^6.0.1",
"ipfs-core": "^0.11.1",
"ipfs-repo": "^13.0.5",
"it-all": "^1.0.4",
"multiformats": "^9.4.1",
"uint8arrays": "^3.0.0"
Expand Down
Loading