Skip to main content

read

method promises.FileHandle.read
Jump to headingFileHandle.read<T extends ArrayBufferView>(
buffer: T,
offset?: number | null,
length?: number | null,
position?: number | null,
): Promise<FileReadResult<T>>

Reads data from the file and stores that in the given buffer.

If the file is not modified concurrently, the end-of-file is reached when the number of bytes read is zero.

Type Parameters Jump to heading

Jump to headingT extends ArrayBufferView

Parameters Jump to heading

A buffer that will be filled with the file data read.

optional
Jump to headingoffset: number | null

The location in the buffer at which to start filling.

optional
Jump to headinglength: number | null

The number of bytes to read.

optional
Jump to headingposition: number | null

The location where to begin reading data from the file. If null, data will be read from the current file position, and the position will be updated. If position is an integer, the current file position will remain unchanged.

Return Type Jump to heading

Promise<FileReadResult<T>>

Fulfills upon success with an object with two properties:

Jump to headingFileHandle.read<T extends ArrayBufferView = Buffer>(options?: FileReadOptions<T>): Promise<FileReadResult<T>>

Type Parameters Jump to heading

Jump to headingT extends ArrayBufferView = Buffer

Parameters Jump to heading

Return Type Jump to heading

Promise<FileReadResult<T>>
Back to top