Skip to content

readFileSync

readFileSync<T>(this, path, options): BufferView<T>

Defined in: src/node/sync.ts:177

Synchronously reads the entire contents of a file.

T extends ArrayBufferView<ArrayBufferLike>

unknown

PathOrFileDescriptor

ReadFileSyncOptionsWithBuffer<T>

BufferView<T>

file contents

encoding The string encoding for the file contents. Defaults to null.

flag Defaults to 'r'.

buffer A view (or a factory taking the file size) the contents are read into, instead of allocating a new buffer. It must be large enough to hold the entire file.

readFileSync(this, path, options?): NonSharedBuffer

Defined in: src/node/sync.ts:182

Synchronously reads the entire contents of a file.

unknown

PathOrFileDescriptor

ReadFileSyncOptionsWithBufferEncoding | null

NonSharedBuffer

file contents

encoding The string encoding for the file contents. Defaults to null.

flag Defaults to 'r'.

buffer A view (or a factory taking the file size) the contents are read into, instead of allocating a new buffer. It must be large enough to hold the entire file.

readFileSync(this, path, options): string

Defined in: src/node/sync.ts:187

Synchronously reads the entire contents of a file.

unknown

PathOrFileDescriptor

BufferEncoding | ReadFileSyncOptionsWithStringEncoding

string

file contents

encoding The string encoding for the file contents. Defaults to null.

flag Defaults to 'r'.

buffer A view (or a factory taking the file size) the contents are read into, instead of allocating a new buffer. It must be large enough to hold the entire file.

readFileSync(this, path, options): string | NonSharedBuffer

Defined in: src/node/sync.ts:192

Synchronously reads the entire contents of a file.

unknown

PathOrFileDescriptor

ReadFileSyncOptions

string | NonSharedBuffer

file contents

encoding The string encoding for the file contents. Defaults to null.

flag Defaults to 'r'.

buffer A view (or a factory taking the file size) the contents are read into, instead of allocating a new buffer. It must be large enough to hold the entire file.