# `•nput` — Write a file

`path •nput data` writes `data` to a new file. It returns the number of bytes written as a [shy](../terms.md#term-shy) result. Text is written as UTF-8. An array of numbers is written as bytes, each from 0 to 255, in ravel order. A path that starts with `./` or `../` is relative to the file holding the code, as for [`•load`](load.md).

`"-" •nput data` writes `data` to standard output, with no line ending added. Text written this way just before a read of [`⎕`](https://bpl.fast.ai//glyphs/quad.html) is that read's prompt. See [`⎕`](../glyphs/quad.md#input).

`X •nput data` takes an options record on the left: `path`, `overwrite` (`1` replaces an existing file, as in `["path":p "overwrite":1] •nput data`) and `encoding` (`"UTF-8"`, for text). With the option `unique`, `•nput` writes a new file with a unique name inside the directory `path`. It returns the new file's path, which is displayed. The option `prefix` sets the start of the name, as for [`•mkdir`](mkdir.md). Plain text on the left is the path. [Files](../data.md#files) covers bytes and options.

Errors: `IO` for an existing file without `overwrite`, and for other file errors; `DOMAIN` for invalid options or byte values, and for bytes written to standard output that aren't UTF-8.
