@zenfs/core 1.8.5 → 1.8.6
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/dist/backends/port/fs.js
CHANGED
|
@@ -4,6 +4,7 @@ import { Errno, ErrnoError } from '../../error.js';
|
|
|
4
4
|
import { FileSystem } from '../../filesystem.js';
|
|
5
5
|
import { Async } from '../../mixins/async.js';
|
|
6
6
|
import { Stats } from '../../stats.js';
|
|
7
|
+
import { decodeUTF8 } from '../../utils.js';
|
|
7
8
|
import { InMemory } from '../memory.js';
|
|
8
9
|
import * as RPC from './rpc.js';
|
|
9
10
|
/**
|
|
@@ -56,7 +56,7 @@ export interface FileData {
|
|
|
56
56
|
flag: string;
|
|
57
57
|
stats: StatsLike<number>;
|
|
58
58
|
}
|
|
59
|
-
export { FileData as File };
|
|
59
|
+
export type { FileData as File };
|
|
60
60
|
export declare function isMessage(arg: unknown): arg is Message;
|
|
61
61
|
type _Executor = Parameters<ConstructorParameters<typeof Promise<any>>[0]>;
|
|
62
62
|
export interface Executor {
|
|
@@ -23,8 +23,10 @@ export declare class Index extends Map<string, Readonly<Inode>> {
|
|
|
23
23
|
* Converts the index to a string
|
|
24
24
|
*/
|
|
25
25
|
toString(): string;
|
|
26
|
+
directoryEntries(path: string): Record<string, number>;
|
|
26
27
|
/**
|
|
27
|
-
* Gets a list of entries for each directory in the index.
|
|
28
|
+
* Gets a list of entries for each directory in the index.
|
|
29
|
+
* Use
|
|
28
30
|
*/
|
|
29
31
|
directories(): Map<string, Record<string, number>>;
|
|
30
32
|
/**
|
|
@@ -25,12 +25,25 @@ export class Index extends Map {
|
|
|
25
25
|
toString() {
|
|
26
26
|
return JSON.stringify(this.toJSON());
|
|
27
27
|
}
|
|
28
|
+
directoryEntries(path) {
|
|
29
|
+
const node = this.get(path);
|
|
30
|
+
if (!node)
|
|
31
|
+
throw ErrnoError.With('ENOENT', path);
|
|
32
|
+
if ((node.mode & S_IFMT) != S_IFDIR)
|
|
33
|
+
throw ErrnoError.With('ENOTDIR', path);
|
|
34
|
+
const entries = {};
|
|
35
|
+
for (const entry of this.keys()) {
|
|
36
|
+
if (dirname(entry) == path && entry != path) {
|
|
37
|
+
entries[basename(entry)] = this.get(entry).ino;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return entries;
|
|
41
|
+
}
|
|
28
42
|
/**
|
|
29
|
-
* Gets a list of entries for each directory in the index.
|
|
43
|
+
* Gets a list of entries for each directory in the index.
|
|
44
|
+
* Use
|
|
30
45
|
*/
|
|
31
46
|
directories() {
|
|
32
|
-
if (this._directories)
|
|
33
|
-
return this._directories;
|
|
34
47
|
const dirs = new Map();
|
|
35
48
|
for (const [path, node] of this) {
|
|
36
49
|
if ((node.mode & S_IFMT) != S_IFDIR)
|
|
@@ -42,7 +55,6 @@ export class Index extends Map {
|
|
|
42
55
|
}
|
|
43
56
|
dirs.set(path, entries);
|
|
44
57
|
}
|
|
45
|
-
this._directories = dirs;
|
|
46
58
|
return dirs;
|
|
47
59
|
}
|
|
48
60
|
/**
|