---
title: "writeFile"
source: "https://github.com/remix-run/remix/blob/8905f3943706e1f53696ab83e70a84873cabfc90/packages/fs/src/lib/fs.ts#L93"
---

# writeFile

## 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](https://developer.mozilla.org/en-US/docs/Web/API/File)

## Signature

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

```

## Parameters

### `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