Badger Filesystem
Javascript Filesystem Utilities
This module implements objects to simplify the process of working with files and directories using Node.js.
import { file } from '@abw/badger-filesystem'
// create a JSON file
const hello = file('hello.json', { codec: 'json' });
// write some data to it
await hello.write({ message: 'Hello World!' });
// read data from it
const data = await hello.read();
import { dir } from '@abw/badger-filesystem'
// a config directory
const config = dir('config');
// check it exists and create it if not
await config.mustExist({ create: true });
// create a JSON file in the directory
const hello = config.file('hello.json', { codec: 'json' });
// write some data to it
await hello.write({ message: 'Hello World!' });
// read data from it
const data = await hello.read();