Deprecated. Use the @bevry/fs-* packages instead
Installations
npm install safefs
Developer Guide
Typescript
No
Module System
CommonJS
Min. Node Version
>=4
Node Version
20.10.0
NPM Version
10.2.3
Score
98.8
Supply Chain
100
Quality
76.2
Maintenance
100
Vulnerability
100
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Developer
Download Statistics
Total Downloads
75,035,406
Last Day
23,386
Last Week
102,367
Last Month
486,770
Last Year
6,461,465
GitHub Statistics
7 Stars
266 Commits
3 Forks
2 Watching
2 Branches
5 Contributors
Bundle Size
12.75 kB
Minified
4.10 kB
Minified + Gzipped
Sponsor this package
Package Meta Information
Latest Version
8.10.0
Package Id
safefs@8.10.0
Unpacked Size
35.99 kB
Size
10.66 kB
File Count
6
NPM Version
10.2.3
Node Version
20.10.0
Publised On
02 Jan 2024
Total Downloads
Cumulative downloads
Total Downloads
75,035,406
Last day
-42.8%
23,386
Compared to previous day
Last week
-26%
102,367
Compared to previous week
Last month
3.8%
486,770
Compared to previous month
Last year
1.6%
6,461,465
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Safe FS
Stop getting EMFILE errors! Open only as many files as the operating system supports.
Usage
1var 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 itappendFile(path, data, options?, next)
- ensure the full path exists before writing to itmkdir(path, mode?, next)
- mode defaults to0o777 & (~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'smdir -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:
- @bevry/fs-accessible
- @bevry/fs-executable
- @bevry/fs-list
- @bevry/fs-mkdirp
- @bevry/fs-read
- @bevry/fs-readable
- @bevry/fs-remove
- @bevry/fs-rmdir
- @bevry/fs-unlink
- @bevry/fs-write
- @bevry/fs-writable
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
aliasessafefs/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:
1{ 2 "compilerOptions": { 3 "maxNodeModuleJsDepth": 5 4 } 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
- Benjamin Lupton — Accelerating collaborative wisdom.
Maintainers
- Benjamin Lupton — Accelerating collaborative wisdom.
Contributors
- Benjamin Lupton — view contributions
- James Gill — view contributions
- Kyle Robinson Young — view contributions
- Sean Fridman — view contributions
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
- Andrew Nesbitt
- Armen Mkrtchian
- Balsa
- Chad
- Codecov
- dr.dimitru
- Elliott Ditman
- entroniq
- GitHub
- Hunter Beast
- Jean-Luc Geering
- Michael Duane Mooring
- Michael Harry Scepaniak
- Mohammed Shah
- Mr. Henry
- Nermal
- Pleo
- Poonacha Medappa
- Rob Morris
- Robert de Forest
- Sentry
- ServieJS
- Skunk Team
- Syntax
- WriterJohnBuck
License
Unless stated otherwise all works are:
- Copyright © Benjamin Lupton
and licensed under:
No vulnerabilities found.
Reason
security policy file detected
Details
- Info: security policy file detected: SECURITY.md:1
- Info: Found linked content: SECURITY.md:1
- Info: Found disclosure, vulnerability, and/or timelines in security policy: SECURITY.md:1
- Info: Found text in security policy: SECURITY.md:1
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE.md:0
- Warn: project license file does not contain an FSF or OSI license.
Reason
1 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
Reason
SAST tool is not run on all commits -- score normalized to 5
Details
- Warn: 5 commits out of 10 are checked with a SAST tool
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/bevry.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/bevry/safefs/bevry.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/bevry.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/bevry/safefs/bevry.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/bevry.yml:35: update your workflow using https://app.stepsecurity.io/secureworkflow/bevry/safefs/bevry.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/bevry.yml:48: update your workflow using https://app.stepsecurity.io/secureworkflow/bevry/safefs/bevry.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/bevry.yml:50: update your workflow using https://app.stepsecurity.io/secureworkflow/bevry/safefs/bevry.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/bevry.yml:61: update your workflow using https://app.stepsecurity.io/secureworkflow/bevry/safefs/bevry.yml/master?enable=pin
- Warn: third-party GitHubAction not pinned by hash: .github/workflows/bevry.yml:66: update your workflow using https://app.stepsecurity.io/secureworkflow/bevry/safefs/bevry.yml/master?enable=pin
- Info: 0 out of 5 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 2 third-party GitHubAction dependencies pinned
Reason
Found 0/20 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: jobLevel 'contents' permission set to 'write': .github/workflows/bevry.yml:72
- Warn: no topLevel permission defined: .github/workflows/bevry.yml:1
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Score
4.2
/10
Last Scanned on 2025-02-03
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More