fsd-fs 0.13.0 → 0.14.0
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/LICENSE +1 -1
- package/lib/index.js +6 -7
- package/package.json +4 -4
package/LICENSE
CHANGED
package/lib/index.js
CHANGED
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const util = require("util");
|
|
4
3
|
const os = require("os");
|
|
5
4
|
const Path = require("path");
|
|
6
5
|
const fs = require("fs");
|
|
7
6
|
const isStream = require("is-stream");
|
|
8
|
-
const
|
|
7
|
+
const glob_1 = require("glob");
|
|
9
8
|
const mapLimit = require("async/mapLimit");
|
|
10
9
|
const Debugger = require("debug");
|
|
11
|
-
const glob = util.promisify(_glob);
|
|
12
10
|
const debug = Debugger('fsd-fs');
|
|
13
11
|
async function getStat(path) {
|
|
14
12
|
try {
|
|
15
13
|
return await fs.promises.stat(path);
|
|
16
14
|
}
|
|
17
|
-
catch (
|
|
15
|
+
catch (_e) {
|
|
18
16
|
return null;
|
|
19
17
|
}
|
|
20
18
|
}
|
|
@@ -89,9 +87,10 @@ class FSAdapter {
|
|
|
89
87
|
}
|
|
90
88
|
let pattern = recursion || '*';
|
|
91
89
|
let p = Path.join(this._options.root, path);
|
|
92
|
-
let files = await glob(pattern, {
|
|
90
|
+
let files = await (0, glob_1.glob)(pattern, {
|
|
93
91
|
cwd: p
|
|
94
92
|
});
|
|
93
|
+
files.reverse();
|
|
95
94
|
return await mapLimit(files, 20, async (name) => {
|
|
96
95
|
let filePath = Path.join(p, name);
|
|
97
96
|
let stat = await getStat(filePath);
|
|
@@ -134,13 +133,13 @@ class FSAdapter {
|
|
|
134
133
|
debug('check is file %s', path);
|
|
135
134
|
let p = Path.join(this._options.root, path);
|
|
136
135
|
let stat = await getStat(p);
|
|
137
|
-
return stat
|
|
136
|
+
return stat?.isFile();
|
|
138
137
|
}
|
|
139
138
|
async isDirectory(path) {
|
|
140
139
|
debug('check is directory %s', path);
|
|
141
140
|
let p = Path.join(this._options.root, path);
|
|
142
141
|
let stat = await getStat(p);
|
|
143
|
-
return stat
|
|
142
|
+
return stat?.isDirectory();
|
|
144
143
|
}
|
|
145
144
|
async size(path) {
|
|
146
145
|
debug('get file size %s', path);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fsd-fs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "File system adapter for fsd",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
"license": "MIT",
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"async": "*",
|
|
16
|
-
"debug": "^4.
|
|
17
|
-
"glob": "^
|
|
16
|
+
"debug": "^4.4.0",
|
|
17
|
+
"glob": "^10.4.5",
|
|
18
18
|
"is-stream": "^2.0.1"
|
|
19
19
|
},
|
|
20
|
-
"gitHead": "
|
|
20
|
+
"gitHead": "74e32bf47242909f040eb6012dda56e5c5a668a0"
|
|
21
21
|
}
|