Skip to content

reekoheek/node-fser

Repository files navigation

fser

Wrapper to work with multiple adapter of Node.js filesystem.

fser functions will return Promise.

Sometimes you need memory-fs to substitute native Node.js fs in test environment.

How to use

const { mkdirp, exists, writeFile, readdir, rmrf } = require('fser');

const fs = require('fs');
// or
// let MemoryFs = require('memory-fs');
// let data = {};
// const fs = new MemoryFs(data);

await mkdirp(fs, '/to/directory');
let isDirExists = await exists(fs, '/to/directory');

await writeFile(fs, '/to/directory/some-file.txt', 'blablabla');
let isFileExists = await exists(fs, '/to/directory/some-file.txt');

let files = await readdir(fs, '/to/directory');

await rmrf(fs, '/to/directory');

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published