Installations
npm install fs-p
Developer Guide
Typescript
Yes
Module System
CommonJS
Node Version
18.16.0
NPM Version
9.5.1
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
TypeScript (50.85%)
JavaScript (49.15%)
Developer
grammarly
Download Statistics
Total Downloads
399,126
Last Day
33
Last Week
425
Last Month
1,072
Last Year
58,476
GitHub Statistics
4 Stars
7 Commits
5 Forks
10 Watching
1 Branches
5 Contributors
Bundle Size
32.45 kB
Minified
9.49 kB
Minified + Gzipped
Package Meta Information
Latest Version
1.0.4
Package Id
fs-p@1.0.4
Unpacked Size
19.93 kB
Size
6.20 kB
File Count
7
NPM Version
9.5.1
Node Version
18.16.0
Publised On
06 Jun 2023
Total Downloads
Cumulative downloads
Total Downloads
399,126
Last day
-63.3%
33
Compared to previous day
Last week
8.7%
425
Compared to previous week
Last month
-61.8%
1,072
Compared to previous month
Last year
-17%
58,476
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
1
DEPRECATED
fs-extra has a promise-based API as of v4.0.0. TypeScript-friendly.
fs-p
fs-p
is a TypeScript-friendly promise-based wrapper on top of fs-extra package.
Why?
Previously, there was no TypeScript-friendly promise-based fs-extra
implementation. Now there is.
Installation
npm install --save fs-p
or yarn add fs-p
Usage
fs-p
api is no different from fs-extra
, except, async methods are wrapped in Promises.
Check out the original fs-extra
documentation.
Promise-based async
Most methods are async and return Promises, unlike the original fs-extra
callback-based implementaion.
Sync methods, on the other hand, will throw if an error occurs.
fs-p
vs fs-extra
Methods with no return value example:
1import * as fs from 'fs-extra' 2import * as fsp from 'fs-p' 3 4// fs-extra callback style 5fs.copy('/tmp/myfile', '/tmp/mynewfile', (err: Error) => { 6 if (err) return console.error(err) 7 console.log("success!") 8}) // copies file 9 10// fs-p promise-based 11fsp.copy('/tmp/mydir', '/tmp/mynewdir').then( 12 () => console.log('success!') 13).catch((err) => console.error(err)) 14 15// fs-p async/await 16try { 17 await fsp.copy('/tmp/mydir', '/tmp/mynewdir') 18 console.log('success!') 19} catch (err) { console.error(err) }
Methods with a return value:
1import * as fs from 'fs-extra' 2import * as fsp from 'fs-p' 3 4// fs-extra callback style 5fs.readJson('./package.json', (err: Error, packageObj: any) => { 6 console.log(packageObj.version) // => 0.1.3 7}) 8 9// fs-p promise-based 10fsp.readJson('./package.json').then( 11 (packageObj: any) => console.log(packageObj.version) // => 0.1.3 12).catch((err) => console.error(err)) 13 14// fs-p async/await 15try { 16 const packageObj: any = await fsp.readJson('./package.json') 17 console.log(packageObj.version) // => 0.1.3 18} catch (err) { console.error(err) }
Credits
fs-p
is just a small wrapper over a remarkable fs-extra
package. Thus, all the credit goes to fs-extra
authors
License
Copyright 2017 Grammarly, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: Apache License 2.0: LICENSE:0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/6 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
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'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 2 are checked with a SAST tool
Reason
12 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-832h-xg76-4gv6
- Warn: Project is vulnerable to: GHSA-hr2v-3952-633q
- Warn: Project is vulnerable to: GHSA-h6ch-v84p-w6p9
- Warn: Project is vulnerable to: GHSA-ff7x-qrg7-qggm
- Warn: Project is vulnerable to: GHSA-pfrx-2q88-qq97
- Warn: Project is vulnerable to: GHSA-qqgx-2p2h-9c37
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m
- Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h
- Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-v2p6-4mp7-3r9v
Score
1.7
/10
Last Scanned on 2025-01-13
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 MoreOther packages similar to fs-p
make-dir
Make a directory and its parents if needed - Think `mkdir -p`
fs-extra-p
fs-extra module promisified with bluebird
fs-extra2
fs-extra contains methods that aren't included in the vanilla Node.js fs package. Such as mkdir -p, cp -r, and rm -rf.
fs-tools
fs helper utilities (walk, copy, mkdir -p)