function readFileSync
Usage in Deno
```typescript import { readFileSync } from "node:node__fs.d.ts"; ```
readFileSync(path: PathOrFileDescriptor,options?: { encoding?: null | undefined; flag?: string | undefined; } | null,): Buffer
Returns the contents of the `path`.
For detailed information, see the documentation of the asynchronous version of
this API: [readFile](../.././node__fs.d.ts/~/readFile).
If the `encoding` option is specified then this function returns a
string. Otherwise it returns a buffer.
Similar to [readFile](../.././node__fs.d.ts/~/readFile), when the path is a directory, the behavior of `fs.readFileSync()` is platform-specific.
```js
import { readFileSync } from 'node:fs';
// macOS, Linux, and Windows
readFileSync('');
// => [Error: EISDIR: illegal operation on a directory, read ]
// FreeBSD
readFileSync(''); // =>
```
path: PathOrFileDescriptor
filename or file descriptor
Buffer
readFileSync(path: PathOrFileDescriptor,options: { encoding: BufferEncoding; flag?: string | undefined; } | BufferEncoding,): string
Synchronously reads the entire contents of a file.
path: PathOrFileDescriptor
A path to a file. If a URL is provided, it must use the `file:` protocol.
If a file descriptor is provided, the underlying file will _not_ be closed automatically.
string
readFileSync(path: PathOrFileDescriptor,options?: ,): string | Buffer
Synchronously reads the entire contents of a file.
path: PathOrFileDescriptor
A path to a file. If a URL is provided, it must use the `file:` protocol.
If a file descriptor is provided, the underlying file will _not_ be closed automatically.
string | Buffer