Promise wrapper written in ES6 for the Node.js filesystem API
npm install es6-fs --save
Is an ES2015 Proxy around the Node.js File System API.
Also includes custom helper methods documented below.
Recurses a directory and returns all paths in the directory and all subdirectories.
Options:
includeDirectories
<boolean> (Defaults tofalse
) - Whether to include directories in the returned paths (otherwise only files).
Returns a promise that will resolve to an array of paths.
Recurses a directory and returns all paths in the directory and all subdirectories.
Options:
includeDirectories
<boolean> (Defaults tofalse
) - Whether to include directories in the returned paths (otherwise only files).
Returns an array of paths.
const fs = require("es6-fs");
fs.writeFile("helloworld.txt", "Hello World!")
.then(() => console.log("File written!"))
.catch(err => console.error(err));
const fs = require("es6-fs");
fs.readFile("helloworld.txt")
.then(contents => console.log(contents)) // Hello World!
.catch(err => console.error(err));