@zenfs/core 1.9.0 → 1.9.2
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.
|
@@ -60,6 +60,7 @@ export class IndexFS extends FileSystem {
|
|
|
60
60
|
this.index.set(to, inode);
|
|
61
61
|
await this.write(to, data, 0);
|
|
62
62
|
}
|
|
63
|
+
await this.remove(oldPath);
|
|
63
64
|
}
|
|
64
65
|
renameSync(oldPath, newPath) {
|
|
65
66
|
for (const { from, to, inode } of this.pathsForRename(oldPath, newPath)) {
|
|
@@ -69,14 +70,19 @@ export class IndexFS extends FileSystem {
|
|
|
69
70
|
this.index.set(to, inode);
|
|
70
71
|
this.writeSync(to, data, 0);
|
|
71
72
|
}
|
|
73
|
+
this.removeSync(oldPath);
|
|
72
74
|
}
|
|
73
75
|
async stat(path) {
|
|
74
|
-
|
|
76
|
+
const inode = this.index.get(path);
|
|
77
|
+
if (!inode)
|
|
78
|
+
throw ErrnoError.With('ENOENT', path, 'stat');
|
|
79
|
+
return new Stats(inode);
|
|
75
80
|
}
|
|
76
81
|
statSync(path) {
|
|
77
|
-
|
|
82
|
+
const inode = this.index.get(path);
|
|
83
|
+
if (!inode)
|
|
78
84
|
throw ErrnoError.With('ENOENT', path, 'stat');
|
|
79
|
-
return new Stats(
|
|
85
|
+
return new Stats(inode);
|
|
80
86
|
}
|
|
81
87
|
async openFile(path, flag) {
|
|
82
88
|
var _a;
|
package/package.json
CHANGED
package/tests/fs/rename.test.ts
CHANGED
|
@@ -66,7 +66,7 @@ suite('Rename', () => {
|
|
|
66
66
|
await fs.promises.writeFile(one, 'hey');
|
|
67
67
|
await fs.promises.rename(one, two);
|
|
68
68
|
|
|
69
|
-
assert(
|
|
69
|
+
assert.equal(await fs.promises.readFile(two, 'utf8'), 'hey');
|
|
70
70
|
assert(!(await fs.promises.exists(one)));
|
|
71
71
|
});
|
|
72
72
|
|