Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Generated on Feb 29, 2024 via pnpm

fs-extra 11.1.1

fs-extra contains methods that aren't included in the vanilla Node.js fs package. Such as recursive mkdir, copy, and remove.
Package summary
Share
0
issues
2
licenses
3
MIT
1
ISC
Package created
16 Nov 2011
Version published
20 Mar 2023
Maintainers
3
Total deps
4
Direct deps
3
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
3 Packages, Including:
fs-extra@11.1.1
jsonfile@6.1.0
universalify@2.0.1

ISC License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
Cannot
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
graceful-fs@4.2.11
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

3
All Dependencies CSV
β“˜ This is a list of fs-extra 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
graceful-fs4.2.119.57 kBISC
prod optional
jsonfile6.1.05.68 kBMIT
prod
universalify2.0.12.02 kBMIT
prod

Visualizations

Frequently Asked Questions

What does fs-extra do?

FS-Extra is a module that extends the native fs module provided in Node.js. Offering additional functionalities not available in the built-in fs, FS-Extra includes methods that support and enhance operations such as creating directories recursively (mkdirs, mkdirsSync), copying directories or files (copy, copySync), and removing directories and their contents (remove, removeSync). The biggest selling point for FS-Extra is that all these utility functions come with promise support out of the box, rendering third-party Promise libraries unnecessary.

How do you use fs-extra?

Here's how you can use FS-Extra in your Node.js project. First, you need to install the FS-Extra package using the Node Package Manager (NPM) by executing npm install fs-extra in your terminal.

Next, replace your conventional fs require statement with fs-extra:

const fs = require('fs-extra');

Or for clarity and maintaining distinction from 'fs', you can name your variable fse:

const fse = require('fs-extra');

Here's a practical usage example. Let's say you want to copy a file to a new location asynchronously:

fs.copy('/tmp/myfile', '/tmp/mynewfile')
  .then(() => console.log('File has been successfully copied!'))
  .catch(err => console.error('An error occurred while copying file:', err));

If you want to do this synchronously, you can do so by doing:

try {
  fs.copySync('/tmp/myfile', '/tmp/mynewfile');
  console.log('File has been successfully copied!');
} catch (err) {
  console.error('An error occurred while copying file:', err);
}

With a simple require statement, not only do you get access to all the original fs functionalities, but also an enriched set of methods that result in cleaner, more maintainable code.

Where are the fs-extra docs?

The official FS-Extra documentation is available on the GitHub repository's README file. It's accessible via https://github.com/jprichardson/node-fs-extra link. The documentation comprises detailed descriptions and usage examples for each method in the FS-Extra toolbox.