1.1.1 • Published 5 years ago

es6-fs v1.1.1

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

node-es6-fs

Promise wrapper written in ES6 for the Node.js filesystem API

Installation

npm install es6-fs --save

FS

Is an ES2015 Proxy around the Node.js File System API.

Also includes custom helper methods documented below.

FS Custom asynchronous methods

FS.recursedir(dirPath, options)

Recurses a directory and returns all paths in the directory and all subdirectories.

Options:

  • includeDirectories <boolean> (Defaults to false) - Whether to include directories in the returned paths (otherwise only files).

Returns a promise that will resolve to an array of paths.

FS Custom synchronous methods

FS.recursedirSync(dirPath, options)

Recurses a directory and returns all paths in the directory and all subdirectories.

Options:

  • includeDirectories <boolean> (Defaults to false) - Whether to include directories in the returned paths (otherwise only files).

Returns an array of paths.

Basic usage

Write a file

const fs = require("es6-fs");

fs.writeFile("helloworld.txt", "Hello World!")
.then(() => console.log("File written!"))
.catch(err => console.error(err));

Read a file

const fs = require("es6-fs");

fs.readFile("helloworld.txt")
.then(contents => console.log(contents)) // Hello World!
.catch(err => console.error(err));
1.1.1

5 years ago

1.1.0

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago