0.2.1 • Published 7 years ago

@frctl/ffs v0.2.1

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

ffs

Fractal filesystem utilities.

Build Status NPM Version

API

.readDir(src)

Reads a directory (or directories) of files and represents them as File objects. Returns a Promise.

  • src: Directory path (or array of paths) to read from required
const fs = require('@frctl/fs');

fs.readDir('path/to/files').then(files => {
  console.log(files);
});

.cloneFile(file, props)

Clone a File, optionally overwriting it's properties with those from props.

  • file: Instance of File that should be cloned required
  • props: Set of properties to overwrite on the cloned file
const fs = require('@frctl/fs');

const file = new fs.File({
  path: '/path/to/file.js',
  contents: Buffer.from('The file contents')
});

const cloned = fs.cloneFile(file, {
  path: '/path/to/foo.js'
});

Installation

npm i @frctl/ffs --save

Requirements

Node >= v6.0 is required.