Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fs-wishlist

Package Overview
Dependencies
Maintainers
2
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fs-wishlist

Mixins for the Node.JS file system adding the functionality we wish it had.

  • 2.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created
Source

FS Wishlist

npm npm Build Status Coverage Status

Mixins for the Node.JS file system adding the functionality we wish it had.

Usage

mixin(fs, [options])

Mixin an implementation of the file system interface.

Options
  • mixins Object Optional enables/disables mixins
var fsWishlist = require('fs-wishlist');
var fs = require('fs');
var xfs = fsWishlist.mixin(fs);

xfs.mkdirp('test/subdirectory/a').then(function() {
  // Test directories created recursively
}, function(reason) {
  // Something went wrong
});

replace([options])

Replace the fs module with an already mixed in vesion of fs.

Options
require('fs-wishlist').replace();

var fs = require('fs');
fs.readdirp('test').then(function(files) {
  // Files contains all files in the `test` directory
}, function(reason) {
  // Something went wrong
});

Mixins

For all methods callbacks are optional, if provided they will be used otherwise a promise will be returned.

fs.mkdirp(path[, mode][, callback])

Recursively create directories if they don't exist.

var xfs = require('fs-wishlist').replace();

xfs.mkdirp('/one/two/three').then(function() {
  // Directories created
}, function(reason) {
  // Something went wrong!
});

fs.rmdirp(path[, callback])

Recursively removes the given directory.

var xfs = require('fs-wishlist').replace();

xfs.rmdirp('/one').then(function() {
  // All directories and files removed from `/one` and below
}, function(reason) {
  // Something went wrong!
});

fs.readdirp(path[, callback])

Recursively reads the given directory.

var xfs = require('fs-wishlist').replace();

xfs.readdirp('/one').then(function(files) {
  // `files` contains a list of all files and directories in `/one` recursively
}, function(reason) {
  // Something went wrong!
});

fs.copyDir(sourcePath, destinationPath[, callback])

Recursively copies the contents of a directory to the destination, creates the destination directories if they do not exist. This overwrites the files if they already exist, and directories themselves are not copied but instead a new directory is created of the same name.

var xfs = require('fs-wishlist').replace();

xfs.copyDir('/one', '/two').then(function() {
  // All of the same directories created in the destination and the files are copied recursively
}, function(reason) {
  // Something went wrong!
});

Keywords

FAQs

Package last updated on 13 Dec 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc