flexfs

2.3.1 • Public • Published

flexfs

source issues documentation

node package manager travis-ci lgtm david-dm david-dm

Flexible and easy to use mixins for node's fs or subclasses, with Promises and value add functions.

Install

Node
npm i flexfs

Usage

To use flexfs, first you must initialize an instance of your favorite fs library. For example, node's native fs and BrowserFS are used in tests.

const { supplimentFS, extraFS } = require('flexfs')
const fs = require('fs')
// now dynamically attach functions from flexfs mixin
fs.mkdirp = extraFS.mkdirp
fs.cpr = extraFS.cpr
// use fs.mkdirp and fs.cpr

To use as an es6 class mixin, first use object-to-class.

const o2c = require('object-to-class')
const ExtraFS = o2c(extraFS, 'ExtraFS')
class MyFS extends ExtraFS {}
let myfs = new MyFS()
myfs instanceof ExtraFS // true

Promise API

Every function is either natively written for Promises or is converted using pify.

Mixins

extraFS

The following functions were implemented as extras, available through ExtraFS.

Function Description
mkdirp Make a directory and any parent directories which didn't exists.
cpr Copy a directory recursively.
supplimentFS

The following functions are alternate implementation of core fs functionality. They are useful for incomplete or new fs implementations.

Function Description
copyFile Copy a file from old location to new. (standard)

License

MIT Copyright isysd public@iramiller.com

Readme

Keywords

Package Sidebar

Install

npm i flexfs

Weekly Downloads

1

Version

2.3.1

License

MIT

Unpacked Size

1.83 MB

Total Files

11

Last publish

Collaborators

  • isysd