From a8bee73fc9dfcb6cab9051e0f6aff4a38c4d9d06 Mon Sep 17 00:00:00 2001 From: streamich Date: Thu, 15 Jun 2023 13:03:21 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20add=20typed=20array=20vi?= =?UTF-8?q?ew=20support=20to=20volume?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/volume.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/volume.ts b/src/volume.ts index e93317130..83d73ef26 100644 --- a/src/volume.ts +++ b/src/volume.ts @@ -43,7 +43,7 @@ export interface IError extends Error { } export type TFileId = PathLike | number; // Number is used as a file descriptor. -export type TData = TDataOut | Uint8Array; // Data formats users can give us. +export type TData = TDataOut | ArrayBufferView | DataView; // Data formats users can give us. export type TFlags = string | number; export type TMode = string | number; // Mode can be a String, although docs say it should be a Number. export type TTime = number | string | Date; @@ -1199,9 +1199,9 @@ export class Volume { return file.write(buf, offset, length, position); } - writeSync(fd: number, buffer: Buffer | Uint8Array, offset?: number, length?: number, position?: number): number; + writeSync(fd: number, buffer: Buffer | ArrayBufferView | DataView, offset?: number, length?: number, position?: number): number; writeSync(fd: number, str: string, position?: number, encoding?: BufferEncoding): number; - writeSync(fd: number, a: string | Buffer | Uint8Array, b?: number, c?: number | BufferEncoding, d?: number): number { + writeSync(fd: number, a: string | Buffer | ArrayBufferView | DataView, b?: number, c?: number | BufferEncoding, d?: number): number { validateFd(fd); let encoding: BufferEncoding | undefined; @@ -1233,12 +1233,12 @@ export class Volume { return this.writeBase(fd, buf, offset, length, position); } - write(fd: number, buffer: Buffer | Uint8Array, callback: (...args) => void); - write(fd: number, buffer: Buffer | Uint8Array, offset: number, callback: (...args) => void); - write(fd: number, buffer: Buffer | Uint8Array, offset: number, length: number, callback: (...args) => void); + write(fd: number, buffer: Buffer | ArrayBufferView | DataView, callback: (...args) => void); + write(fd: number, buffer: Buffer | ArrayBufferView | DataView, offset: number, callback: (...args) => void); + write(fd: number, buffer: Buffer | ArrayBufferView | DataView, offset: number, length: number, callback: (...args) => void); write( fd: number, - buffer: Buffer | Uint8Array, + buffer: Buffer | ArrayBufferView | DataView, offset: number, length: number, position: number,