@zenfs/core 0.0.12 → 0.1.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.
@@ -5,7 +5,7 @@ import { FileFlag, PreloadFile } from '../file.js';
5
5
  import { SynchronousFileSystem } from '../filesystem.js';
6
6
  import Inode from '../inode.js';
7
7
  import { FileType } from '../stats.js';
8
- import { encode, randomUUID, ROOT_NODE_ID } from '../utils.js';
8
+ import { decode, encode, randomUUID, ROOT_NODE_ID } from '../utils.js';
9
9
  /**
10
10
  * A simple RW transaction for simple synchronous key-value stores.
11
11
  */
@@ -367,7 +367,7 @@ export class SyncKeyValueFileSystem extends SynchronousFileSystem {
367
367
  if (data === undefined) {
368
368
  throw ApiError.ENOENT(p);
369
369
  }
370
- return JSON.parse(data.toString());
370
+ return JSON.parse(decode(data));
371
371
  }
372
372
  /**
373
373
  * Creates a new node under a random ID. Retries 5 times before giving up in
@@ -1,4 +1,4 @@
1
- import type { BFSCallback, FileSystem } from '../filesystem.js';
1
+ import type { TwoArgCallback, FileSystem } from '../filesystem.js';
2
2
  /**
3
3
  * Describes a file system option.
4
4
  */
@@ -64,11 +64,11 @@ export interface BackendConstructor<FS extends typeof FileSystem = typeof FileSy
64
64
  */
65
65
  Create(): Promise<InstanceType<FS>>;
66
66
  Create(options: object): Promise<InstanceType<FS>>;
67
- Create(cb: BFSCallback<InstanceType<FS>>): void;
68
- Create(options: object, cb: BFSCallback<InstanceType<FS>>): void;
69
- Create(options: object, cb?: BFSCallback<InstanceType<FS>>): Promise<InstanceType<FS>> | void;
67
+ Create(cb: TwoArgCallback<InstanceType<FS>>): void;
68
+ Create(options: object, cb: TwoArgCallback<InstanceType<FS>>): void;
69
+ Create(options: object, cb?: TwoArgCallback<InstanceType<FS>>): Promise<InstanceType<FS>> | void;
70
70
  }
71
71
  export declare function CreateBackend<FS extends BaseBackendConstructor>(this: FS): Promise<InstanceType<FS>>;
72
72
  export declare function CreateBackend<FS extends BaseBackendConstructor>(this: FS, options: BackendOptions): Promise<InstanceType<FS>>;
73
- export declare function CreateBackend<FS extends BaseBackendConstructor>(this: FS, cb: BFSCallback<InstanceType<FS>>): void;
74
- export declare function CreateBackend<FS extends BaseBackendConstructor>(this: FS, options: BackendOptions, cb: BFSCallback<InstanceType<FS>>): void;
73
+ export declare function CreateBackend<FS extends BaseBackendConstructor>(this: FS, cb: TwoArgCallback<InstanceType<FS>>): void;
74
+ export declare function CreateBackend<FS extends BaseBackendConstructor>(this: FS, options: BackendOptions, cb: TwoArgCallback<InstanceType<FS>>): void;