writeSync - Node documentation
function writeSync

Usage in Deno

import { writeSync } from "node:fs";
writeSync(
fd: number,
buffer: ArrayBufferView,
offset?: number | null,
length?: number | null,
position?: number | null,
): number

For detailed information, see the documentation of the asynchronous version of this API: write.

Parameters

fd: number
buffer: ArrayBufferView
optional
offset: number | null = 0
optional
length: number | null = buffer.byteLength - offset
optional
position: number | null = 'null'

Return Type

number

The number of bytes written.

writeSync(
fd: number,
string: string,
position?: number | null,
encoding?: BufferEncoding | null,
): number

Synchronously writes string to the file referenced by the supplied file descriptor, returning the number of bytes written.

Parameters

fd: number

A file descriptor.

string: string

A string to write.

optional
position: number | null

The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position.

optional
encoding: BufferEncoding | null

The expected string encoding.

Return Type

number