8.10.0 • Published 4 months ago

safefs v8.10.0

Weekly downloads
295,374
License
Artistic-2.0
Repository
github
Last release
4 months ago

Safe FS

Stop getting EMFILE errors! Open only as many files as the operating system supports.

Usage

Complete API Documentation.

var safefs = require('safefs')

SafeFS uses graceful-fs to wrap all of the standard file system methods to avoid EMFILE errors among other problems.

On-top of graceful-fs, SafeFS also adds additional wrapping on the following methods:

  • writeFile(path, data, options?, next) - ensure the full path exists before writing to it
  • appendFile(path, data, options?, next) - ensure the full path exists before writing to it
  • mkdir(path, mode?, next) - mode defaults to 0o777 & (~process.umask())
  • unlink(path, next) - checks if the file exists before removing it

SafeFS also define these additional methods:

  • ensurePath(path, options, next) - ensure the full path exists, equivalent to unix's mdir -p path
  • getParentPathSync(path) - returns the parent directory of the path

Alternatives

You should use these instead, which use and provide modern APIs while providing brilliant ecosystem support:

Install

npm

  • Install: npm install --save safefs
  • Import: import * as pkg from ('safefs')
  • Require: const pkg = require('safefs')

Editions

This package is published with the following editions:

  • safefs aliases safefs/source/index.js
  • safefs/source/index.js is ESNext source code for Node.js 4 || 6 || 8 || 10 || 12 || 14 || 16 || 18 || 20 || 21 with Require for modules

TypeScript

This project provides its type information via inline JSDoc Comments. To make use of this in TypeScript, set your maxNodeModuleJsDepth compiler option to 5 or thereabouts. You can accomplish this via your tsconfig.json file like so:

{
  "compilerOptions": {
    "maxNodeModuleJsDepth": 5
  }
}

History

Discover the release history by heading on over to the HISTORY.md file.

Backers

Code

Discover how to contribute via the CONTRIBUTING.md file.

Authors

Maintainers

Contributors

Finances

Sponsors

  • Andrew Nesbitt — Software engineer and researcher
  • Balsa — We're Balsa, and we're building tools for builders.
  • Codecov — Empower developers with tools to improve code quality and testing.
  • Poonacha Medappa
  • Rob Morris
  • Sentry — Real-time crash reporting for your web apps, mobile apps, and games.
  • Syntax — Syntax Podcast

Donors

License

Unless stated otherwise all works are:

and licensed under:

8.10.0

4 months ago

8.8.0

4 months ago

8.9.0

4 months ago

8.7.0

4 months ago

8.6.0

5 months ago

8.1.0

5 months ago

8.2.0

5 months ago

8.4.0

5 months ago

8.3.0

5 months ago

8.5.0

5 months ago

8.0.0

5 months ago

6.16.0

3 years ago

6.15.0

3 years ago

6.14.0

3 years ago

6.13.0

4 years ago

6.12.0

4 years ago

6.11.0

4 years ago

6.10.0

4 years ago

6.9.0

4 years ago

6.8.0

4 years ago

6.7.0

4 years ago

6.6.0

4 years ago

6.5.0

4 years ago

6.4.0

4 years ago

6.3.0

4 years ago

6.2.0

4 years ago

6.1.0

4 years ago

6.0.0

4 years ago

5.5.0

4 years ago

5.4.0

4 years ago

5.3.0

4 years ago

5.2.0

4 years ago

5.1.0

4 years ago

5.0.0

4 years ago

4.2.0

4 years ago

4.1.0

8 years ago

4.0.1

8 years ago

4.0.0

9 years ago

3.2.2

9 years ago

3.2.1

9 years ago

3.2.0

9 years ago

3.1.3

9 years ago

3.1.2

9 years ago

3.1.1

10 years ago

3.1.0

10 years ago

3.0.6

10 years ago

3.0.5

10 years ago

3.0.4

10 years ago

3.0.3

11 years ago

3.0.2

11 years ago

3.0.1

11 years ago

3.0.0

11 years ago

2.0.3

11 years ago

2.0.2

11 years ago

2.0.1

11 years ago

2.0.0

11 years ago