Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including enfs with all npm packages installed. Try it out:

var enfs = require("enfs")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

enfs v1.0.0

Extras suite for node fs module

Build Status Build status Codacy Badge Donate



Module that add methods and patches to node fs module

enfs stands for [E]asy [N]ode [fs]


This module will add many methods to node fs module. This is just the main module that will join many modules of the family of enfs, making it easier to use many of the methods present in each module.


Methods Added

  • emptyDir
  • emptyDirSync


enfs is a drop-in replacement for native fs module, you just need to include it instead of the native module.

Use this

    var enfs = require("enfs");

instead of

    var fs = require("fs"); //You don't need to do this anymore

and all the methods from native fs module are available


All the methods follows the node culture.

  • Async: Every async method returns an Error in the first callback parameter
  • Sync: Every sync method throws an Error.

Additional Methods


  • emptyDir(path, callback)

Remove all items from the directory this method use rimraf, then you can pass wildcards to the path like you do in rimraf

    enfs.emptyDir("/path/to/empty/*", function(err){
        if(!err) {
            console.log("Directory is empty");


  • emptyDirSync(path)

Remove all items from the directory this method use rimraf.sync, then you can pass wildcards to the path like you do in rimraf

    console.log("Directory is empty");

Additional mehods from modules


Creative Commons Attribution 4.0 International License

Copyright (c) 2016 Joao Parreira GitHub

This work is licensed under the Creative Commons Attribution 4.0 International License. To view a copy of this license, visit CC-BY-4.0.


RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free