@@ -29,7 +29,7 @@ async function processFolder (store, prefix, fileNameProcessor) {
29
29
prefix : `/${ prefix } `
30
30
}
31
31
32
- const files = await store . query ( query )
32
+ const files = store . query ( query )
33
33
for await ( let file of files ) {
34
34
const name = String ( file . key . _buf ) . replace ( `/${ prefix } /` , '' )
35
35
const encodedFileName = fileNameProcessor ( name )
@@ -42,7 +42,7 @@ async function processFolder (store, prefix, fileNameProcessor) {
42
42
}
43
43
44
44
async function migrate ( repoPath , options , isBrowser ) {
45
- let storageBackend
45
+ let storageBackend , storageBackendOptions
46
46
if ( options !== undefined
47
47
&& options [ 'storageBackends' ] !== undefined
48
48
&& options [ 'storageBackends' ] [ 'keys' ] !== undefined
@@ -52,7 +52,16 @@ async function migrate (repoPath, options, isBrowser) {
52
52
storageBackend = Datastore
53
53
}
54
54
55
- const store = new storageBackend ( path . join ( repoPath , 'keys' ) , { extension : '.data' } )
55
+ if ( options !== undefined
56
+ && options [ 'storageBackendOptions' ] !== undefined
57
+ && options [ 'storageBackendOptions' ] [ 'keys' ] !== undefined
58
+ ) {
59
+ storageBackendOptions = options [ 'storageBackendOptions' ] [ 'keys' ]
60
+ } else {
61
+ storageBackendOptions = { }
62
+ }
63
+
64
+ const store = new storageBackend ( path . join ( repoPath , 'keys' ) , storageBackendOptions )
56
65
try {
57
66
const info = processFolder ( store , 'info' , encode )
58
67
const data = processFolder ( store , 'pkcs8' , encode )
@@ -71,7 +80,7 @@ let storageBackend
71
80
) {
72
81
storageBackend = options [ 'storageBackends' ] [ 'keys' ]
73
82
} else {
74
- storageBackend = Datastore
83
+ storageBackend = FSDatastore
75
84
}
76
85
77
86
const store = new storageBackend ( path . join ( repoPath , 'keys' ) , { extension : '.data' } )
0 commit comments