Skip to main content
Deno 2 is finally here 🎉️
Learn more
Go to Latest
The Standard Library has been moved to JSR. See the blog post for details.
function writeSync
import { writeSync } from "https://deno.land/std@0.132.0/node/_fs/_fs_write.d.ts";

If buffer is a plain object, it must have an own (not inherited) toStringfunction property.

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

Parameters

fd: number
buffer: ArrayBufferView
optional
offset: number | null
optional
length: number | null
optional
position: number | null

Returns

number

The number of bytes written.

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.

Returns

number