writeFile

View Source

Summary

Writes a file-like object to the local filesystem and resolves when the stream is finished.

Accepts any object with a stream() method, including native File, Blob, and LazyFile.

MDN File Reference

Signature

function writeFile(
  to: string | number | FileHandle,
  file: { stream: any },
): Promise<void>;

Params

to

The path to write the file to, or an open file descriptor

file

The file to write (any object with a stream() method)

Returns

A promise that resolves when the file is written