mobiletto 1.1.38 → 1.1.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/drivers/local/index.js +28 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -307,7 +307,7 @@ You can also set per-connection caching with the `opts.redisConfig` object:
|
|
|
307
307
|
To disable: pass `enabled: false` in your `opts.redisConfig` object when you establish your connection.
|
|
308
308
|
|
|
309
309
|
As discussed below, disabling caching will have an adverse effect on performance and incur more requests
|
|
310
|
-
to storage
|
|
310
|
+
to storage than you really need to.
|
|
311
311
|
|
|
312
312
|
### Caching guidance
|
|
313
313
|
**Encrypted storage**: reading/writing encrypted storage is only a little slower than normal,
|
package/drivers/local/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const { dirname } = require('path')
|
|
1
|
+
const { dirname, basename } = require('path')
|
|
2
2
|
|
|
3
3
|
const {
|
|
4
4
|
M_FILE, M_DIR, M_LINK, M_SPECIAL, isAsyncGenerator, isReadable,
|
|
@@ -106,14 +106,39 @@ class StorageClient {
|
|
|
106
106
|
dirFiles = async (dir, visitor) => {
|
|
107
107
|
const norm = this.normalizePath(dir);
|
|
108
108
|
try {
|
|
109
|
-
|
|
109
|
+
const names = fs.readdirSync(norm);
|
|
110
110
|
const files = names.map(this.fileToObject(norm))
|
|
111
111
|
for (const f of files) {
|
|
112
112
|
await visitor(f)
|
|
113
113
|
}
|
|
114
114
|
return files
|
|
115
115
|
} catch (e) {
|
|
116
|
-
|
|
116
|
+
if (isNotExistError(e)) {
|
|
117
|
+
// try to list the parent directory and filter for just this file
|
|
118
|
+
const files = []
|
|
119
|
+
try {
|
|
120
|
+
const parent = dirname(norm)
|
|
121
|
+
const base = basename(norm)
|
|
122
|
+
const names = fs.readdirSync(parent)
|
|
123
|
+
for (const n of names) {
|
|
124
|
+
if (n === base) {
|
|
125
|
+
const f = this.fileToObject(parent)(base)
|
|
126
|
+
files.push(f)
|
|
127
|
+
await visitor(f)
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
} catch (e2) {
|
|
131
|
+
logger.warn(`dirFiles (try-file) error: ${JSON.stringify(e2)}`)
|
|
132
|
+
throw this.ioError(e2, norm, 'dirFiles')
|
|
133
|
+
}
|
|
134
|
+
if (files.length > 0) {
|
|
135
|
+
return files
|
|
136
|
+
} else {
|
|
137
|
+
logger.warn(`dirFiles (try-file) not found: ${norm}`)
|
|
138
|
+
throw this.ioError(e, norm, 'dirFiles')
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
logger.warn(`dirFiles error: ${JSON.stringify(e)}`)
|
|
117
142
|
throw this.ioError(e, norm, 'dirFiles')
|
|
118
143
|
}
|
|
119
144
|
}
|