@jsvfs/adapter-node-fs

The official `jsvfs` adapter for Node's `fs` module.

Usage no npm install needed!

<script type="module">
  import jsvfsAdapterNodeFs from 'https://cdn.skypack.dev/@jsvfs/adapter-node-fs';
</script>

README

JSVFS Adapter: Node fs

The official adapter for @jsvfs/core supporting Node's fs module as a back-end for jsvfs.

Allows a developer to define the current working directory that acts as the root of the adapter, and to enable the flush functionality of the adapter. This second option is important, as flush in this adapter attempts to completely remove all files and folders from the root of the adapter. To protect developers against accidentally destroying files, this option defaults to false and must be intentionally enabled.

If you're looking to create new adapters, please use @jsvfs/types and look to this module as an example.

Supported Features

  • Async commits
  • Pass-through reads
  • Snapshots
  • Flush
  • Journaling

Installation

Get it from npm:

npm install --save @jsvfs/adapter-node-fs

Usage

This adapter requires no options, but it will bind by default to the current working directory of the process. Pass a directory in the cwd property to bind to that instead.

import { NodeFSAdapter } from '@jsvfs/adapter-node-fs'

const adapter = new NodeFSAdapter({ cwd: '/tmp' })

Documentation

Complete documentation of jsvfs can be found at the jsvfs site.