1
1
'use strict'
2
2
3
3
const { create } = require ( 'ipfs-core' )
4
- const {
5
- createRepo,
6
- locks : {
7
- fs : fsLock
8
- }
9
- } = require ( 'ipfs-repo' )
4
+ const { createRepo } = require ( 'ipfs-repo' )
5
+ const FSLock = require ( 'ipfs-repo/locks/fs' )
10
6
const all = require ( 'it-all' )
11
7
const { fromString : uint8ArrayFromString } = require ( 'uint8arrays/from-string' )
12
8
const { concat : uint8ArrayConcat } = require ( 'uint8arrays/concat' )
13
- const DatastoreFS = require ( 'datastore-fs' )
14
- const BlockstoreDatastoreAdapter = require ( 'blockstore-datastore-adapter' )
9
+ const { FsDatastore } = require ( 'datastore-fs' )
10
+ const { BlockstoreDatastoreAdapter } = require ( 'blockstore-datastore-adapter' )
15
11
16
12
// multiformat codecs to support
17
13
const codecs = [
@@ -46,31 +42,31 @@ async function main () {
46
42
* you could store your keys in a levelDB database while everything else is in files.
47
43
* See https://www.npmjs.com/package/interface-datastore for more about datastores.
48
44
*/
49
- root : new DatastoreFS ( path , {
45
+ root : new FsDatastore ( path , {
50
46
extension : '.ipfsroot' , // Defaults to '', appended to all files
51
47
errorIfExists : false , // If the datastore exists, don't throw an error
52
48
createIfMissing : true // If the datastore doesn't exist yet, create it
53
49
} ) ,
54
50
// blocks is a blockstore, all other backends are datastores - but we can wrap a datastore
55
51
// in an adapter to turn it into a blockstore
56
52
blocks : new BlockstoreDatastoreAdapter (
57
- new DatastoreFS ( `${ path } /blocks` , {
53
+ new FsDatastore ( `${ path } /blocks` , {
58
54
extension : '.ipfsblock' ,
59
55
errorIfExists : false ,
60
56
createIfMissing : true
61
57
} )
62
58
) ,
63
- keys : new DatastoreFS ( `${ path } /keys` , {
59
+ keys : new FsDatastore ( `${ path } /keys` , {
64
60
extension : '.ipfskey' ,
65
61
errorIfExists : false ,
66
62
createIfMissing : true
67
63
} ) ,
68
- datastore : new DatastoreFS ( `${ path } /datastore` , {
64
+ datastore : new FsDatastore ( `${ path } /datastore` , {
69
65
extension : '.ipfsds' ,
70
66
errorIfExists : false ,
71
67
createIfMissing : true
72
68
} ) ,
73
- pins : new DatastoreFS ( `${ path } /pins` , {
69
+ pins : new FsDatastore ( `${ path } /pins` , {
74
70
extension : '.ipfspin' ,
75
71
errorIfExists : false ,
76
72
createIfMissing : true
@@ -80,7 +76,7 @@ async function main () {
80
76
* A custom lock can be added here. Or the build in Repo `fs` or `memory` locks can be used.
81
77
* See https://github.com/ipfs/js-ipfs-repo for more details on setting the lock.
82
78
*/
83
- lock : fsLock
79
+ lock : FSLock
84
80
} ) ,
85
81
86
82
// This just means we dont try to connect to the network which isn't necessary
0 commit comments