readFileSync
Call Signature
Section titled “Call Signature”readFileSync<
T>(this,path,options):BufferView<T>
Defined in: src/node/sync.ts:177
Synchronously reads the entire contents of a file.
Type Parameters
Section titled “Type Parameters”T extends ArrayBufferView<ArrayBufferLike>
Parameters
Section titled “Parameters”unknown
PathOrFileDescriptor
options
Section titled “options”ReadFileSyncOptionsWithBuffer<T>
Returns
Section titled “Returns”BufferView<T>
file contents
Option
Section titled “Option”encoding The string encoding for the file contents. Defaults to null.
Option
Section titled “Option”flag Defaults to 'r'.
Option
Section titled “Option”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.
Call Signature
Section titled “Call Signature”readFileSync(
this,path,options?):NonSharedBuffer
Defined in: src/node/sync.ts:182
Synchronously reads the entire contents of a file.
Parameters
Section titled “Parameters”unknown
PathOrFileDescriptor
options?
Section titled “options?”ReadFileSyncOptionsWithBufferEncoding | null
Returns
Section titled “Returns”NonSharedBuffer
file contents
Option
Section titled “Option”encoding The string encoding for the file contents. Defaults to null.
Option
Section titled “Option”flag Defaults to 'r'.
Option
Section titled “Option”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.
Call Signature
Section titled “Call Signature”readFileSync(
this,path,options):string
Defined in: src/node/sync.ts:187
Synchronously reads the entire contents of a file.
Parameters
Section titled “Parameters”unknown
PathOrFileDescriptor
options
Section titled “options”BufferEncoding | ReadFileSyncOptionsWithStringEncoding
Returns
Section titled “Returns”string
file contents
Option
Section titled “Option”encoding The string encoding for the file contents. Defaults to null.
Option
Section titled “Option”flag Defaults to 'r'.
Option
Section titled “Option”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.
Call Signature
Section titled “Call Signature”readFileSync(
this,path,options):string|NonSharedBuffer
Defined in: src/node/sync.ts:192
Synchronously reads the entire contents of a file.
Parameters
Section titled “Parameters”unknown
PathOrFileDescriptor
options
Section titled “options”ReadFileSyncOptions
Returns
Section titled “Returns”string | NonSharedBuffer
file contents
Option
Section titled “Option”encoding The string encoding for the file contents. Defaults to null.
Option
Section titled “Option”flag Defaults to 'r'.
Option
Section titled “Option”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.