@zenfs/core 0.3.1 → 0.3.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.
- package/dist/FileIndex.d.ts +3 -3
- package/dist/backends/AsyncMirror.d.ts +16 -15
- package/dist/backends/AsyncMirror.js +4 -5
- package/dist/backends/AsyncStore.d.ts +8 -8
- package/dist/backends/AsyncStore.js +3 -4
- package/dist/backends/InMemory.js +2 -2
- package/dist/backends/Locked.d.ts +1 -1
- package/dist/backends/Locked.js +3 -3
- package/dist/backends/Overlay.d.ts +1 -1
- package/dist/backends/Overlay.js +5 -5
- package/dist/backends/SyncStore.d.ts +8 -8
- package/dist/backends/SyncStore.js +3 -4
- package/dist/browser.min.js +2 -2
- package/dist/browser.min.js.map +3 -3
- package/dist/file.js +6 -6
- package/dist/filesystem.d.ts +4 -4
- package/dist/filesystem.js +7 -7
- package/package.json +1 -1
package/dist/file.js
CHANGED
|
@@ -296,7 +296,7 @@ export class PreloadFile extends File {
|
|
|
296
296
|
*/
|
|
297
297
|
truncate(len) {
|
|
298
298
|
this.truncateSync(len);
|
|
299
|
-
if (this.flag.isSynchronous() && !this.fs.metadata.synchronous) {
|
|
299
|
+
if (this.flag.isSynchronous() && !this.fs.metadata().synchronous) {
|
|
300
300
|
return this.sync();
|
|
301
301
|
}
|
|
302
302
|
}
|
|
@@ -314,7 +314,7 @@ export class PreloadFile extends File {
|
|
|
314
314
|
const buf = new Uint8Array(len - this._buffer.length);
|
|
315
315
|
// Write will set stats.size for us.
|
|
316
316
|
this.writeSync(buf, 0, buf.length, this._buffer.length);
|
|
317
|
-
if (this.flag.isSynchronous() && this.fs.metadata.synchronous) {
|
|
317
|
+
if (this.flag.isSynchronous() && this.fs.metadata().synchronous) {
|
|
318
318
|
this.syncSync();
|
|
319
319
|
}
|
|
320
320
|
return;
|
|
@@ -322,7 +322,7 @@ export class PreloadFile extends File {
|
|
|
322
322
|
this.stats.size = len;
|
|
323
323
|
// Truncate buffer to 'len'.
|
|
324
324
|
this._buffer = this._buffer.subarray(0, len);
|
|
325
|
-
if (this.flag.isSynchronous() && this.fs.metadata.synchronous) {
|
|
325
|
+
if (this.flag.isSynchronous() && this.fs.metadata().synchronous) {
|
|
326
326
|
this.syncSync();
|
|
327
327
|
}
|
|
328
328
|
}
|
|
@@ -441,7 +441,7 @@ export class PreloadFile extends File {
|
|
|
441
441
|
* @param mode
|
|
442
442
|
*/
|
|
443
443
|
chmodSync(mode) {
|
|
444
|
-
if (!this.fs.metadata.supportsProperties) {
|
|
444
|
+
if (!this.fs.metadata().supportsProperties) {
|
|
445
445
|
throw new ApiError(ErrorCode.ENOTSUP);
|
|
446
446
|
}
|
|
447
447
|
this._dirty = true;
|
|
@@ -462,7 +462,7 @@ export class PreloadFile extends File {
|
|
|
462
462
|
* @param gid
|
|
463
463
|
*/
|
|
464
464
|
chownSync(uid, gid) {
|
|
465
|
-
if (!this.fs.metadata.supportsProperties) {
|
|
465
|
+
if (!this.fs.metadata().supportsProperties) {
|
|
466
466
|
throw new ApiError(ErrorCode.ENOTSUP);
|
|
467
467
|
}
|
|
468
468
|
this._dirty = true;
|
|
@@ -473,7 +473,7 @@ export class PreloadFile extends File {
|
|
|
473
473
|
this.utimesSync(atime, mtime);
|
|
474
474
|
}
|
|
475
475
|
utimesSync(atime, mtime) {
|
|
476
|
-
if (!this.fs.metadata.supportsProperties) {
|
|
476
|
+
if (!this.fs.metadata().supportsProperties) {
|
|
477
477
|
throw new ApiError(ErrorCode.ENOTSUP);
|
|
478
478
|
}
|
|
479
479
|
this._dirty = true;
|
package/dist/filesystem.d.ts
CHANGED
|
@@ -46,7 +46,7 @@ export interface FileSystemMetadata {
|
|
|
46
46
|
* - All arguments are present. Any optional arguments at the Node API level have been passed in with their default values.
|
|
47
47
|
*/
|
|
48
48
|
export declare abstract class FileSystem {
|
|
49
|
-
|
|
49
|
+
metadata(): FileSystemMetadata;
|
|
50
50
|
constructor(options?: object);
|
|
51
51
|
abstract ready(): Promise<this>;
|
|
52
52
|
/**
|
|
@@ -157,7 +157,7 @@ export declare abstract class FileSystem {
|
|
|
157
157
|
* @internal
|
|
158
158
|
*/
|
|
159
159
|
declare abstract class SyncFileSystem extends FileSystem {
|
|
160
|
-
|
|
160
|
+
metadata(): FileSystemMetadata;
|
|
161
161
|
ready(): Promise<this>;
|
|
162
162
|
exists(path: string, cred: Cred): Promise<boolean>;
|
|
163
163
|
rename(oldPath: string, newPath: string, cred: Cred): Promise<void>;
|
|
@@ -179,7 +179,7 @@ export declare function Sync<T extends abstract new (...args: any[]) => FileSyst
|
|
|
179
179
|
* @internal
|
|
180
180
|
*/
|
|
181
181
|
declare abstract class AsyncFileSystem {
|
|
182
|
-
|
|
182
|
+
metadata(): FileSystemMetadata;
|
|
183
183
|
renameSync(oldPath: string, newPath: string, cred: Cred): void;
|
|
184
184
|
statSync(path: string, cred: Cred): Stats;
|
|
185
185
|
createFileSync(path: string, flag: FileFlag, mode: number, cred: Cred): File;
|
|
@@ -196,7 +196,7 @@ export declare function Async<T extends abstract new (...args: any[]) => FileSys
|
|
|
196
196
|
* @internal
|
|
197
197
|
*/
|
|
198
198
|
declare abstract class ReadonlyFileSystem {
|
|
199
|
-
|
|
199
|
+
metadata(): FileSystemMetadata;
|
|
200
200
|
rename(oldPath: string, newPath: string, cred: Cred): Promise<void>;
|
|
201
201
|
renameSync(oldPath: string, newPath: string, cred: Cred): void;
|
|
202
202
|
createFile(path: string, flag: FileFlag, mode: number, cred: Cred): Promise<File>;
|
package/dist/filesystem.js
CHANGED
|
@@ -10,7 +10,7 @@ import { ApiError, ErrorCode } from './ApiError.js';
|
|
|
10
10
|
* - All arguments are present. Any optional arguments at the Node API level have been passed in with their default values.
|
|
11
11
|
*/
|
|
12
12
|
export class FileSystem {
|
|
13
|
-
|
|
13
|
+
metadata() {
|
|
14
14
|
return {
|
|
15
15
|
name: this.constructor.name,
|
|
16
16
|
readonly: false,
|
|
@@ -57,8 +57,8 @@ export function Sync(FS) {
|
|
|
57
57
|
* Implements the asynchronous API in terms of the synchronous API.
|
|
58
58
|
*/
|
|
59
59
|
class _SyncFileSystem extends FS {
|
|
60
|
-
|
|
61
|
-
return { ...super.metadata, synchronous: true };
|
|
60
|
+
metadata() {
|
|
61
|
+
return { ...super.metadata(), synchronous: true };
|
|
62
62
|
}
|
|
63
63
|
async ready() {
|
|
64
64
|
return this;
|
|
@@ -101,8 +101,8 @@ export function Sync(FS) {
|
|
|
101
101
|
}
|
|
102
102
|
export function Async(FS) {
|
|
103
103
|
class _AsyncFileSystem extends FS {
|
|
104
|
-
|
|
105
|
-
return { ...super.metadata, synchronous: false };
|
|
104
|
+
metadata() {
|
|
105
|
+
return { ...super.metadata(), synchronous: false };
|
|
106
106
|
}
|
|
107
107
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
108
108
|
renameSync(oldPath, newPath, cred) {
|
|
@@ -141,8 +141,8 @@ export function Async(FS) {
|
|
|
141
141
|
}
|
|
142
142
|
export function Readonly(FS) {
|
|
143
143
|
class _ReadonlyFileSystem extends FS {
|
|
144
|
-
|
|
145
|
-
return { ...super.metadata, readonly: true };
|
|
144
|
+
metadata() {
|
|
145
|
+
return { ...super.metadata(), readonly: true };
|
|
146
146
|
}
|
|
147
147
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
148
148
|
async rename(oldPath, newPath, cred) {
|