rads-db 0.1.90 → 0.1.92
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.
|
@@ -20,7 +20,12 @@ var _default = {
|
|
|
20
20
|
},
|
|
21
21
|
async readdir(filepath, options) {
|
|
22
22
|
sanitizeFilepath(filepath);
|
|
23
|
-
|
|
23
|
+
try {
|
|
24
|
+
return await readdirRecursive(filepath, options);
|
|
25
|
+
} catch (e) {
|
|
26
|
+
if (e.code === "ENOENT") return [];
|
|
27
|
+
throw e;
|
|
28
|
+
}
|
|
24
29
|
},
|
|
25
30
|
async writeFile(filepath, data, options) {
|
|
26
31
|
sanitizeFilepath(filepath);
|
|
@@ -32,7 +37,12 @@ var _default = {
|
|
|
32
37
|
},
|
|
33
38
|
async lstat(filepath, options) {
|
|
34
39
|
sanitizeFilepath(filepath);
|
|
35
|
-
|
|
40
|
+
try {
|
|
41
|
+
return await _promises.default.lstat(filepath, options);
|
|
42
|
+
} catch (e) {
|
|
43
|
+
if (e.code === "ENOENT") return void 0;
|
|
44
|
+
throw e;
|
|
45
|
+
}
|
|
36
46
|
},
|
|
37
47
|
/** Delete a file */
|
|
38
48
|
async unlink(filepath) {
|
|
@@ -62,7 +72,8 @@ async function readdirRecursive(dir, options) {
|
|
|
62
72
|
const results = [];
|
|
63
73
|
for await (const file of klawIterator) {
|
|
64
74
|
if (file.stats.isSymbolicLink()) continue;
|
|
65
|
-
const rp = _nodePath.default.relative(
|
|
75
|
+
const rp = _nodePath.default.relative(dir, file.path).replaceAll("\\", "/");
|
|
76
|
+
if (!rp) continue;
|
|
66
77
|
results.push({
|
|
67
78
|
path: rp,
|
|
68
79
|
type: file.stats.isDirectory() ? "tree" : "blob",
|
|
@@ -13,7 +13,13 @@ export default {
|
|
|
13
13
|
},
|
|
14
14
|
async readdir(filepath, options) {
|
|
15
15
|
sanitizeFilepath(filepath);
|
|
16
|
-
|
|
16
|
+
try {
|
|
17
|
+
return await readdirRecursive(filepath, options);
|
|
18
|
+
} catch (e) {
|
|
19
|
+
if (e.code === "ENOENT")
|
|
20
|
+
return [];
|
|
21
|
+
throw e;
|
|
22
|
+
}
|
|
17
23
|
},
|
|
18
24
|
async writeFile(filepath, data, options) {
|
|
19
25
|
sanitizeFilepath(filepath);
|
|
@@ -25,7 +31,13 @@ export default {
|
|
|
25
31
|
},
|
|
26
32
|
async lstat(filepath, options) {
|
|
27
33
|
sanitizeFilepath(filepath);
|
|
28
|
-
|
|
34
|
+
try {
|
|
35
|
+
return await fs.lstat(filepath, options);
|
|
36
|
+
} catch (e) {
|
|
37
|
+
if (e.code === "ENOENT")
|
|
38
|
+
return void 0;
|
|
39
|
+
throw e;
|
|
40
|
+
}
|
|
29
41
|
},
|
|
30
42
|
/** Delete a file */
|
|
31
43
|
async unlink(filepath) {
|
|
@@ -56,7 +68,9 @@ async function readdirRecursive(dir, options) {
|
|
|
56
68
|
for await (const file of klawIterator) {
|
|
57
69
|
if (file.stats.isSymbolicLink())
|
|
58
70
|
continue;
|
|
59
|
-
const rp = path.relative(
|
|
71
|
+
const rp = path.relative(dir, file.path).replaceAll("\\", "/");
|
|
72
|
+
if (!rp)
|
|
73
|
+
continue;
|
|
60
74
|
results.push({
|
|
61
75
|
path: rp,
|
|
62
76
|
type: file.stats.isDirectory() ? "tree" : "blob",
|