@zenfs/core 1.8.2 → 1.8.3
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/file.js +7 -7
- package/dist/filesystem.d.ts +2 -2
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +1 -1
- package/package.json +1 -1
package/dist/file.js
CHANGED
|
@@ -626,7 +626,7 @@ export class LazyFile extends File {
|
|
|
626
626
|
end = position + Math.max(this.stats.size - position, 0);
|
|
627
627
|
}
|
|
628
628
|
this._position = end;
|
|
629
|
-
return end
|
|
629
|
+
return end;
|
|
630
630
|
}
|
|
631
631
|
/**
|
|
632
632
|
* Read data from the file.
|
|
@@ -637,12 +637,12 @@ export class LazyFile extends File {
|
|
|
637
637
|
* If position is unset, data will be read from the current file position.
|
|
638
638
|
*/
|
|
639
639
|
async read(buffer, offset = 0, length = buffer.byteLength - offset, position = this.position) {
|
|
640
|
-
const
|
|
640
|
+
const end = this.prepareRead(length, position);
|
|
641
641
|
const uint8 = new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
642
|
-
await this.fs.read(this.path, uint8.subarray(offset, offset + length), position,
|
|
642
|
+
await this.fs.read(this.path, uint8.subarray(offset, offset + length), position, end);
|
|
643
643
|
if (config.syncImmediately)
|
|
644
644
|
await this.sync();
|
|
645
|
-
return { bytesRead, buffer };
|
|
645
|
+
return { bytesRead: end - position, buffer };
|
|
646
646
|
}
|
|
647
647
|
/**
|
|
648
648
|
* Read data from the file.
|
|
@@ -654,12 +654,12 @@ export class LazyFile extends File {
|
|
|
654
654
|
* @returns number of bytes written
|
|
655
655
|
*/
|
|
656
656
|
readSync(buffer, offset = 0, length = buffer.byteLength - offset, position = this.position) {
|
|
657
|
-
const
|
|
657
|
+
const end = this.prepareRead(length, position);
|
|
658
658
|
const uint8 = new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength);
|
|
659
|
-
this.fs.readSync(this.path, uint8.subarray(offset, offset + length), position,
|
|
659
|
+
this.fs.readSync(this.path, uint8.subarray(offset, offset + length), position, end);
|
|
660
660
|
if (config.syncImmediately)
|
|
661
661
|
this.syncSync();
|
|
662
|
-
return
|
|
662
|
+
return end - position;
|
|
663
663
|
}
|
|
664
664
|
async chmod(mode) {
|
|
665
665
|
if (this.closed)
|
package/dist/filesystem.d.ts
CHANGED
|
@@ -149,8 +149,8 @@ export declare abstract class FileSystem {
|
|
|
149
149
|
existsSync(path: string): boolean;
|
|
150
150
|
abstract link(target: string, link: string): Promise<void>;
|
|
151
151
|
abstract linkSync(target: string, link: string): void;
|
|
152
|
-
abstract sync(path: string, data?: Uint8Array, stats?: Partial<
|
|
153
|
-
abstract syncSync(path: string, data?: Uint8Array, stats?: Partial<
|
|
152
|
+
abstract sync(path: string, data?: Uint8Array, stats?: Readonly<Partial<StatsLike>>): Promise<void>;
|
|
153
|
+
abstract syncSync(path: string, data?: Uint8Array, stats?: Readonly<Partial<StatsLike>>): void;
|
|
154
154
|
/**
|
|
155
155
|
* Reads into a buffer
|
|
156
156
|
* @param buffer The buffer to read into. You must set the `byteOffset` and `byteLength` appropriately!
|
package/dist/utils.d.ts
CHANGED
|
@@ -73,7 +73,7 @@ export declare function normalizeOptions(options: fs.WriteFileOptions | (fs.Enco
|
|
|
73
73
|
export type Concrete<T extends ClassLike> = Pick<T, keyof T> & (new (...args: any[]) => InstanceType<T>);
|
|
74
74
|
/**
|
|
75
75
|
* Generate a random ino
|
|
76
|
-
* @internal
|
|
76
|
+
* @internal @deprecated @hidden
|
|
77
77
|
*/
|
|
78
78
|
export declare function randomBigInt(): bigint;
|
|
79
79
|
/**
|
package/dist/utils.js
CHANGED
|
@@ -135,7 +135,7 @@ export function normalizeOptions(options, encoding = 'utf8', flag, mode = 0) {
|
|
|
135
135
|
}
|
|
136
136
|
/**
|
|
137
137
|
* Generate a random ino
|
|
138
|
-
* @internal
|
|
138
|
+
* @internal @deprecated @hidden
|
|
139
139
|
*/
|
|
140
140
|
export function randomBigInt() {
|
|
141
141
|
return BigInt('0x' + randomHex(8));
|