[API reference](https://evolu.dev/docs/api-reference) › [@evolu/nodejs](https://evolu.dev/docs/api-reference/nodejs) › createNodeFs

```ts
function createNodeFs(): Fs;
```

Defined in: [packages/nodejs/src/Fs.ts:96](https://github.com/evoluhq/evolu/blob/dd96d79f1dbe9a49fa12ce8e0aa7d3d0177795ca/packages/nodejs/src/Fs.ts#L96)

Creates a [Fs](https://evolu.dev/docs/api-reference/common/Fs/interfaces/Fs) backed by `node:fs/promises`.

`readFile` and `writeFile` pass the Run's abort signal to Node and propagate
the Run's abort reason if Node rejects after cancellation. Cancellation can
leave a write partially completed. Successful operations return their values
even if an abort was requested. Other operations run to completion and return
their results once started, so callers also receive created temporary
directories and can dispose them.

Temporary directory parents are resolved through the file system, preserving
the meaning of symbolic links followed by `..`. Returned paths are absolute,
so cleanup still targets the created directory after a change to the
process's working directory.

### Example

```ts
import {
  assertEqual,
  assertFalse,
  ok,
  type FsDep,
  type FsError,
  type Task,
} from "@evolu/common";

const main: Task<void, FsError, FsDep> = async (run) => {
  const { fs } = run.deps;
  const temp = await run(fs.createTempDirectory({ prefix: "evolu-" }));
  if (!temp.ok) return temp;

  {
    await using directory = temp.value;
    const path = join(directory.path, "config.json");

    const result = await run(fs.writeFile(path, '{ "port": 4000 }'));
    if (!result.ok) return result;

    const text = await run(fs.readFile(path, "utf8"));
    if (!text.ok) return text;
    assertEqual(text.value, '{ "port": 4000 }');
  }

  const exists = await run(fs.exists(temp.value.path));
  if (!exists.ok) return exists;
  assertFalse(exists.value);
  return ok();
};

await runMain({ fs: createNodeFs() }, { mode: "command" })(main);
```