Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

fse

jonathantneal50.8kCC0-1.04.0.1

fs: then-ified, extended, and dependency-free

fs, then, thenified, promiseified, promisified, promises, promised, promise, extends, extended, extend, files, file, system, read, write, remove, copy, touch, json, file, directory, windows, macos, linux

readme

fse fse

NPM Version Unix Status Windows Status

fse is fs as promises, extended, and dependency-free. It features;

  • Node 4+ compatibility, and;
  • improved fs.mkdir, fs.mkdirSync, fs.rmdir, fs.rmdirSync, fs.writeFile, and fs.writeFileSync methods allowing recursive modification of the file system, and;
  • new fs.copydir, fs.copydirSync, fs.copyFile, fs.copyFileSync, fs.readJson, fs.readJsonSync, fs.touchFile, and fs.touchFileSync methods.

New Methods

fse.copydir

fse.copydir(source, target)
  • source <string> | <Buffer> | <URL>
  • target <string> | <Buffer> | <URL>

Promised copying of the contents of a source directory to a target directory. target may be used to create otherwise non-existent directories.

fse.copyFile

fse.copyFile(source, target)
  • source <string> | <Buffer> | <integer> filename or file descriptor
  • target <string> | <Buffer> | <integer> filename or file descriptor

Promised copying of a source file to a target file, replacing the target file if it already exists. target may be used to create otherwise non-existent directories.

fse.readJson

fse.readJson(path)
  • path <string> | <Buffer> | <integer> filename or file descriptor

Promised reading of the entire contents of a JSON file, constructing the JavaScript value or object described by the file. Resolves as the contents of the file, or rejects with an error.

fse.touchFile

fse.touchFile(path)
  • path <string> | <Buffer> | <integer> filename or file descriptor

Promised existence of a file, creating the file if it does not exist. path may be used to create otherwise non-existent directories.


All existing fs methods are available.

Licensing

fse uses the CC0 “No Rights Reserved” license.

changelog

Changes to fse

4.0.1 (November 7, 2017)

  • Fixed: Replaced the deprecated new Buffer() call with Buffer.alloc()
  • Fixed: Skip Node v10.1.0 fs.promises.

4.0.0 (November 7, 2017)

  • Changed: mkdirSync, rmdirSync, writeFileSync methods are now recursive
  • Added: New copydirSync, copyFileSync, readJsonSync, touchFileSync methods
  • Added: Tests for all new functionality
  • Updated: Ensure file exists on copyFile method

3.0.0 (May 17, 2017)

  • Added: Support for Node v4

2.0.0 (April 17, 2017)

  • Removed: watch task — sticking with plain fs promise-ified
  • Removed: path forwarding — sticking with plain fs promise-ified

1.0.1 (January 18, 2017)

  • Removed: Unnecessary catch in copyFile
  • Updated: watch opts now passed into match
  • Updated: watch direction method

1.0.0 (January 13, 2017)

  • Initial version