Installations
npm install file-system
Developer Guide
Typescript
No
Module System
CommonJS
Node Version
6.9.1
NPM Version
3.10.8
Score
99
Supply Chain
100
Quality
75.6
Maintenance
50
Vulnerability
100
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Developer
douzi8
Download Statistics
Total Downloads
33,409,839
Last Day
10,944
Last Week
67,869
Last Month
240,375
Last Year
3,688,502
GitHub Statistics
67 Stars
39 Commits
21 Forks
5 Watching
1 Branches
2 Contributors
Bundle Size
4.88 kB
Minified
1.87 kB
Minified + Gzipped
Package Meta Information
Latest Version
2.2.2
Package Id
file-system@2.2.2
Size
6.25 kB
NPM Version
3.10.8
Node Version
6.9.1
Publised On
17 Nov 2016
Total Downloads
Cumulative downloads
Total Downloads
33,409,839
Last day
-14%
10,944
Compared to previous day
Last week
-3.6%
67,869
Compared to previous week
Last month
-21.3%
240,375
Compared to previous month
Last year
10.6%
3,688,502
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
2
Dev Dependencies
3
file-system — Simplified file system
This module make file opertaion apis simple, you don't need to care the dir exits. and the api is same as node's filesystem. This is no exists time cost for this plugin.
1var fs = require('file-system'); 2 3fs.mkdir('1/2/3/4/5', [mode], function(err) {}); 4fs.mkdirSync('1/2/3/4/5', [mode]); 5fs.writeFile('path/test.txt', 'aaa', function(err) {})
install
npm install file-system --save
API
.fs
file extend node fs origin methods, and overwrite some methods with next list chart
1var file = require('file-system'); 2var fs = require('fs'); 3 4file.readFile === fs.readFile // true
.mkdir
The api is same as node's mkdir
.mkdirSync
The api is same as node's mkdir
.writeFile
The api is same as node's writeFile
.writeFileSync
The api is same as node's writeFile
.fileMatch
The api equal file-match
.copyFile(srcpath, destpath, options)
Asynchronously copy a file into newpath
- {string}
srcpath
required - {string}
destpath
required - {object}
options
- {string}
options.encoding
[options.encoding=utf8] - {function}
options.done(err)
- {function}
options.process(content)
The process argument must return processed content
- {string}
1fs.copyFile('deom.png', 'dest/demo.png', {
2 done: function(err) {
3 console.log('done');
4 }
5});
.copyFileSync(srcpath, destpath, options)
The api same as copyFile, but it's synchronous
1fs.copyFileSync('demo.png', 'dest/demo.png');
2fs.copyFileSync('demo.css', 'dest/demo.css', {
3 process: function(contents) {
4 return contents;
5 }
6})
.recurse(dirpath, filter, callback)
Recurse into a directory, executing callback for each file and folder. if the filename is undefiend, the callback is for folder, otherwise for file.
- {string}
dirpath
required - {string|array|function}
filter
If the filter is function, executing callback for all files and folder - {function}
callback(filepath, filename, relative)
1fs.recurse('path', function(filepath, relative, filename) { }); 2 3fs.recurse('path', [ 4 '*.css', 5 '**/*.js', 6 'path/*.html', 7 '!**/path/*.js' 8], function(filepath, relative, filename) { 9 if (filename) { 10 // it's file 11 } else { 12 // it's folder 13 } 14}); 15 16// Only using files 17fs.recurse('path', function(filepath, relative, filename) { 18 if (!filename) return; 19});
.recurseSync(dirpath, filter, callback)
The api is same as recurse, but it is synchronous
1fs.recurseSync('path', function(filepath, relative, filename) {
2
3});
4
5fs.recurseSync('path', ['**/*.js', 'path/**/*.html'], function(filepath, relative, filename) {
6
7});
.rmdirSync(dirpath)
Recurse into a directory, remove all of the files and folder in this directory.
1fs.rmdirSync('path');
.copySync(dirpath, destpath, options)
Recurse into a directory, copy all files into dest.
- {string}
dirpath
required - {string}
destpath
required - {object}
options
- {string|array}
options.filter
- {function}
options.process(contents, filepath, relative)
If custom the destpath, return object, otherwise return content - {string|array}
options.noProcess
- {string|array}
1fs.copySync('path', 'dest', { clear: true });
2
3fs.copySync('src', 'dest/src');
4
5fs.copySync('src', 'dest/src', { filter: ['*.js', 'path/**/*.css'] });
6
7fs.copySync('path', 'dest', {
8 noProcess: '**/*.{jpg, png}', // Don't process images
9 process: function(contents, filepath, relative) {
10 // only process file content
11 return contents;
12 // or custom destpath
13 return {
14 contents: '',
15 filepath: ''
16 };
17 }
18});
19
20//Handler self files
21fs.copySync('path', 'path', { filter: ['*.html.js'], process: function(contents, filepath) {} });
.base64
Deprecated, move to base64
.base64Sync
Deprecated, move to base64Sync
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
Found 1/28 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
license file not detected
Details
- Warn: project does not have a license file
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
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
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 3 are checked with a SAST tool
Score
2.6
/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 More