Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

File.read

File.read([{ asText, startByte, endByte, signal }]) → Promise<Uint8Array | string>

Reads the file's contents (or a range of them) into memory.

Parameters:

asText : boolean, default false Whether to decode the contents as UTF-8 text, returning a string.

startByte : number, default 0 The first byte to read.

endByte : number, optional The last byte to read (inclusive). Defaults to the end of the file.

signal : AbortSignal, optional

Returns: Promise<Uint8Array>, or Promise<string> if asText is true.

Was this helpful?