@absolunet/fss
Advanced tools
Comparing version 1.0.1 to 1.1.0
88
index.js
@@ -6,39 +6,65 @@ //-------------------------------------------------------- | ||
const del = require('del'); | ||
const fs = require('fs'); | ||
const fsExtra = require('fs-extra'); | ||
const junk = require('junk'); | ||
const klaw = require('klaw-sync'); | ||
const minimatch = require('minimatch'); | ||
const ow = require('ow'); | ||
const path = require('path'); | ||
const fsExtra = require('fs-extra'); | ||
const gracefulFs = require('graceful-fs'); | ||
const junk = require('junk'); | ||
const klaw = require('klaw-sync'); | ||
const minimatch = require('minimatch'); | ||
const ow = require('ow'); | ||
const path = require('path'); | ||
module.exports = { | ||
chmod: fs.chmodSync, | ||
chown: fs.chownSync, | ||
exists: fs.existsSync, | ||
readdir: fs.readdirSync, | ||
readFile: fs.readFileSync, | ||
realpath: fs.realpathSync, | ||
stat: fs.statSync, | ||
symlink: fs.symlinkSync, | ||
writeFile: fs.writeFileSync, | ||
copy: fsExtra.copySync, | ||
ensureDir: fsExtra.ensureDirSync, | ||
outputFile: fsExtra.outputFileSync, | ||
remove: fsExtra.removeSync, | ||
access: gracefulFs.accessSync, | ||
appendFile: gracefulFs.appendFileSync, | ||
chmod: gracefulFs.chmodSync, | ||
chown: gracefulFs.chownSync, | ||
close: gracefulFs.closeSync, | ||
copyFile: gracefulFs.copyFileSync, | ||
exists: gracefulFs.existsSync, | ||
fchmod: gracefulFs.fchmodSync, | ||
fchown: gracefulFs.fchownSync, | ||
fdatasync: gracefulFs.fdatasyncSync, | ||
fstat: gracefulFs.fstatSync, | ||
fsync: gracefulFs.fsyncSync, | ||
ftruncate: gracefulFs.ftruncateSync, | ||
futimes: gracefulFs.futimesSync, | ||
lchmod: gracefulFs.lchmodSync, | ||
lchown: gracefulFs.lchownSync, | ||
link: gracefulFs.linkSync, | ||
lstat: gracefulFs.lstatSync, | ||
mkdir: gracefulFs.mkdirSync, | ||
mkdtemp: gracefulFs.mkdtempSync, | ||
open: gracefulFs.openSync, | ||
readdir: gracefulFs.readdirSync, | ||
readFile: gracefulFs.readFileSync, | ||
readlink: gracefulFs.readlinkSync, | ||
read: gracefulFs.readSync, | ||
realpath: gracefulFs.realpathSync, | ||
rename: gracefulFs.renameSync, | ||
rmdir: gracefulFs.rmdirSync, | ||
stat: gracefulFs.statSync, | ||
symlink: gracefulFs.symlinkSync, | ||
truncate: gracefulFs.truncateSync, | ||
unlink: gracefulFs.unlinkSync, | ||
utimes: gracefulFs.utimesSync, | ||
writeFile: gracefulFs.writeFileSync, | ||
write: gracefulFs.writeSync, | ||
del: del.sync, | ||
copy: fsExtra.copySync, | ||
emptyDir: fsExtra.emptyDirSync, | ||
ensureFile: fsExtra.ensureFileSync, | ||
ensureDir: fsExtra.ensureDirSync, | ||
ensureLink: fsExtra.ensureLinkSync, | ||
ensureSymlink: fsExtra.ensureSymlinkSync, | ||
mkdirp: fsExtra.mkdirpSync, | ||
mkdirs: fsExtra.mkdirsSync, | ||
move: fsExtra.moveSync, | ||
outputFile: fsExtra.outputFileSync, | ||
outputJson: fsExtra.outputJsonSync, | ||
pathExists: fsExtra.pathExistsSync, | ||
readJson: fsExtra.readJsonSync, | ||
remove: fsExtra.removeSync, | ||
writeJson: fsExtra.writeJsonSync, | ||
move: (src, dest, options) => { | ||
ow(src, ow.string.label('src').nonEmpty); | ||
ow(dest, ow.string.label('dest').nonEmpty); | ||
ow(options, ow.any(ow.undefined, ow.object.label('options'))); | ||
fsExtra.copySync(src, dest, options); | ||
fsExtra.removeSync(src); | ||
}, | ||
scandir: (root, type, { recursive = false, fullPath = false, pattern = '**', keepJunk = false } = {}) => { | ||
@@ -45,0 +71,0 @@ ow(root, ow.string.label('root').nonEmpty); |
{ | ||
"name": "@absolunet/fss", | ||
"version": "1.0.1", | ||
"description": "fs / fs-extra sync wrapper", | ||
"version": "1.1.0", | ||
"description": "graceful-fs / fs-extra sync wrapper", | ||
"definition": "", | ||
@@ -12,4 +12,5 @@ "homepage": "https://github.com/absolunet/node-fss", | ||
"keywords": [ | ||
"del", | ||
"fs", | ||
"fs-extra", | ||
"graceful-fs", | ||
"klaw", | ||
@@ -27,3 +28,3 @@ "sync" | ||
"engines": { | ||
"node": ">= 10.8.0" | ||
"node": ">= 10.9.0" | ||
}, | ||
@@ -38,4 +39,4 @@ "main": "index.js", | ||
"dependencies": { | ||
"del": "^3.0.0", | ||
"fs-extra": "^7.0.0", | ||
"graceful-fs": "^4.1.11", | ||
"junk": "^2.1.0", | ||
@@ -42,0 +43,0 @@ "klaw-sync": "^4.0.0", |
193
readme.md
@@ -9,3 +9,3 @@ # @absolunet/fss | ||
> fs / fs-extra / del sync wrapper | ||
> graceful-fs / fs-extra sync wrapper | ||
@@ -29,62 +29,166 @@ | ||
## API | ||
## API mapper | ||
### chmod(path) | ||
Maps [`fs.chmodSync`](https://nodejs.org/api/fs.html#fs_fs_chmodsync_path_mode). | ||
> `fs` is [graceful-fs](https://github.com/isaacs/node-graceful-fs) | ||
### chown(path) | ||
Maps [`fs.chownSync`](https://nodejs.org/api/fs.html#fs_fs_chownsync_path_uid_gid). | ||
> `fse` is [fs-extra](https://github.com/jprichardson/node-fs-extra) | ||
### copy(src, dest, [options]) | ||
Maps [`fsExtra.copySync`](https://github.com/jprichardson/node-fs-extra/blob/master/docs/copy-sync.md). | ||
### del(patterns, [options]) | ||
Maps [`del.sync`](https://github.com/sindresorhus/del#delsyncpatterns-options). | ||
### access | ||
Maps [`fs.accessSync`](https://nodejs.org/api/fs.html#fs_fs_accesssync_path_mode) | ||
### ensureDir(dir) | ||
Maps [`fsExtra.ensureDirSync`](https://github.com/jprichardson/node-fs-extra/blob/master/docs/ensureDir-sync.md). | ||
### appendFile | ||
Maps [`fs.appendFileSync`](https://nodejs.org/api/fs.html#fs_fs_appendfilesync_path_data_options) | ||
### exists(path) | ||
Maps [`fs.existsSync`](https://nodejs.org/api/fs.html#fs_fs_existssync_path). | ||
### chmod | ||
Maps [`fs.chmodSync`](https://nodejs.org/api/fs.html#fs_fs_chmodsync_path_mode) | ||
### chown | ||
Maps [`fs.chownSync`](https://nodejs.org/api/fs.html#fs_fs_chownsync_path_uid_gid) | ||
### close | ||
Maps [`fs.closeSync`](https://nodejs.org/api/fs.html#fs_fs_closesync_fd) | ||
### move(src, dest, [options]) | ||
Simulate a [`mv(1)`](http://man7.org/linux/man-pages/man1/mv.1.html) via a [`fsExtra.copySync`](https://github.com/jprichardson/node-fs-extra/blob/master/docs/copy-sync.md) and a [`fsExtra.removeSync`](https://github.com/jprichardson/node-fs-extra/blob/master/docs/remove-sync.md). | ||
### copy | ||
Maps [`fse.copySync`](https://github.com/jprichardson/node-fs-extra/blob/master/docs/copy-sync.md) | ||
#### src | ||
*Required*<br> | ||
Type: `String`<br> | ||
Path of dir/file to move. | ||
### copyFile | ||
Maps [`fs.copyFileSync`](https://nodejs.org/api/fs.html#fs_fs_copyfilesync_src_dest_flags) | ||
#### dest | ||
*Required*<br> | ||
Type: `String`<br> | ||
Path of destination. | ||
### emptyDir | ||
Maps [`fse.emptyDirSync`](https://github.com/jprichardson/node-fs-extra/blob/master/docs/emptyDir-sync.md) | ||
#### options | ||
Type: `Object`<br> | ||
`fsExtra.copySync` options. | ||
### ensureFile | ||
Maps [`fse.ensureFileSync`](https://github.com/jprichardson/node-fs-extra/blob/master/docs/ensureFile-sync.md) | ||
### ensureDir | ||
Maps [`fse.ensureDirSync`](https://github.com/jprichardson/node-fs-extra/blob/master/docs/ensureDir-sync.md) | ||
<br> | ||
### ensureLink | ||
Maps [`fse.ensureLinkSync`](https://github.com/jprichardson/node-fs-extra/blob/master/docs/ensureLink-sync.md) | ||
### ensureSymlink | ||
Maps [`fse.ensureSymlinkSync`](https://github.com/jprichardson/node-fs-extra/blob/master/docs/ensureSymlink-sync.md) | ||
### outputFile(file, data, [options]) | ||
Maps [`fsExtra.outputFileSync`](https://github.com/jprichardson/node-fs-extra/blob/master/docs/outputFile-sync.md). | ||
### exists | ||
Maps [`fs.existsSync`](https://nodejs.org/api/fs.html#fs_fs_existssync_path) | ||
### readdir(path[, options]) | ||
Maps [`fs.readdirSync`](https://nodejs.org/api/fs.html#fs_fs_readdirsync_path_options). | ||
### fchmod | ||
Maps [`fs.fchmodSync`](https://nodejs.org/api/fs.html#fs_fs_fchmodsync_fd_mode) | ||
### readFile(path[, options]) | ||
Maps [`fs.readFileSync`](https://nodejs.org/api/fs.html#fs_fs_readfilesync_path_options). | ||
### fchown | ||
Maps [`fs.fchownSync`](https://nodejs.org/api/fs.html#fs_fs_fchownsync_fd_uid_gid) | ||
### realpath(path[, options]) | ||
Maps [`fs.realpathSync`](https://nodejs.org/api/fs.html#fs_fs_realpathsync_path_options). | ||
### fdatasync | ||
Maps [`fs.fdatasyncSync`](https://nodejs.org/api/fs.html#fs_fs_fdatasyncsync_fd) | ||
### remove(path) | ||
Maps [`fsExtra.removeSync`](https://github.com/jprichardson/node-fs-extra/blob/master/docs/remove-sync.md). | ||
### fstat | ||
Maps [`fs.fstatSync`](https://nodejs.org/api/fs.html#fs_fs_fstatsync_fd_options) | ||
### fsync | ||
Maps [`fs.fsyncSync`](https://nodejs.org/api/fs.html#fs_fs_fsyncsync_fd) | ||
### ftruncate | ||
Maps [`fs.ftruncateSync`](https://nodejs.org/api/fs.html#fs_fs_ftruncatesync_fd_len) | ||
### futimes | ||
Maps [`fs.futimesSync`](https://nodejs.org/api/fs.html#fs_fs_futimessync_fd_atime_mtime) | ||
### lchmod | ||
Maps [`fs.lchmodSync`](https://nodejs.org/api/fs.html#fs_fs_lchmodsync_path_mode) | ||
### lchown | ||
Maps [`fs.lchownSync`](https://nodejs.org/api/fs.html#fs_fs_lchownsync_path_uid_gid) | ||
### link | ||
Maps [`fs.linkSync`](https://nodejs.org/api/fs.html#fs_fs_linksync_existingpath_newpath) | ||
### lstat | ||
Maps [`fs.lstatSync`](https://nodejs.org/api/fs.html#fs_fs_lstatsync_path_options) | ||
### mkdir | ||
Maps [`fs.mkdirSync`](https://nodejs.org/api/fs.html#fs_fs_mkdirsync_path_mode) | ||
### mkdirp | ||
Maps [`fse.mkdirpSync`](https://github.com/jprichardson/node-fs-extra/blob/master/docs/ensureDir-sync.md) | ||
### mkdirs | ||
Maps [`fse.mkdirsSync`](https://github.com/jprichardson/node-fs-extra/blob/master/docs/ensureDir-sync.md) | ||
### mkdtemp | ||
Maps [`fs.mkdtempSync`](https://nodejs.org/api/fs.html#fs_fs_mkdtempsync_prefix_options) | ||
### move | ||
Maps [`fse.moveSync`](https://github.com/jprichardson/node-fs-extra/blob/master/docs/move-sync.md) | ||
### open | ||
Maps [`fs.openSync`](https://nodejs.org/api/fs.html#fs_fs_opensync_path_flags_mode) | ||
### outputFile | ||
Maps [`fse.outputFileSync`](https://github.com/jprichardson/node-fs-extra/blob/master/docs/outputFile-sync.md) | ||
### outputJson | ||
Maps [`fse.outputJsonSync`](https://github.com/jprichardson/node-fs-extra/blob/master/docs/outputJson-sync.md) | ||
### pathExists | ||
Maps [`fse.pathExistsSync`](https://github.com/jprichardson/node-fs-extra/blob/master/docs/pathExists-sync.md) | ||
### readdir | ||
Maps [`fs.readdirSync`](https://nodejs.org/api/fs.html#fs_fs_readdirsync_path_options) | ||
### readFile | ||
Maps [`fs.readFileSync`](https://nodejs.org/api/fs.html#fs_fs_readfilesync_path_options) | ||
### readlink | ||
Maps [`fs.readlinkSync`](https://nodejs.org/api/fs.html#fs_fs_readlinksync_path_options) | ||
### read | ||
Maps [`fs.readSync`](https://nodejs.org/api/fs.html#fs_fs_readsync_fd_buffer_offset_length_position) | ||
### readJson | ||
Maps [`fse.readJsonSync`](https://github.com/jprichardson/node-fs-extra/blob/master/docs/readJson-sync.md) | ||
### realpath | ||
Maps [`fs.realpathSync`](https://nodejs.org/api/fs.html#fs_fs_realpathsync_path_options) | ||
### realpath.native | ||
Maps [`fs.realpathSync.native`](https://nodejs.org/api/fs.html#fs_fs_realpathsync_native_path_options) | ||
### rename | ||
Maps [`fs.renameSync`](https://nodejs.org/api/fs.html#fs_fs_renamesync_oldpath_newpath) | ||
### remove | ||
Maps [`fse.removeSync`](https://github.com/jprichardson/node-fs-extra/blob/master/docs/remove-sync.md) | ||
### rmdir | ||
Maps [`fs.rmdirSync`](https://nodejs.org/api/fs.html#fs_fs_rmdirsync_path) | ||
### stat | ||
Maps [`fs.statSync`](https://nodejs.org/api/fs.html#fs_fs_statsync_path_options) | ||
### symlink | ||
Maps [`fs.symlinkSync`](https://nodejs.org/api/fs.html#fs_fs_symlinksync_target_path_type) | ||
### truncate | ||
Maps [`fs.truncateSync`](https://nodejs.org/api/fs.html#fs_fs_truncatesync_path_len) | ||
### unlink | ||
Maps [`fs.unlinkSync`](https://nodejs.org/api/fs.html#fs_fs_unlinksync_path) | ||
### utimes | ||
Maps [`fs.utimesSync`](https://nodejs.org/api/fs.html#fs_fs_utimessync_path_atime_mtime) | ||
### writeFile | ||
Maps [`fs.writeFileSync`](https://nodejs.org/api/fs.html#fs_fs_writefilesync_file_data_options) | ||
### write | ||
Maps [`fs.writeSync`](https://nodejs.org/api/fs.html#fs_fs_writesync_fd_buffer_offset_length_position) | ||
### writeJson | ||
Maps [`fse.writeJsonSync`](https://github.com/jprichardson/node-fs-extra/blob/master/docs/writeJson-sync.md) | ||
## API custom | ||
### scandir(root, type, [options]) | ||
@@ -125,18 +229,5 @@ Uses [klaw-sync](https://github.com/manidlou/node-klaw-sync) to scan directory for files or directories.<br> | ||
<br> | ||
### stat(path) | ||
Maps [`fs.statSync`](https://nodejs.org/api/fs.html#fs_fs_statsync_path). | ||
### symlink(target, path[, type]) | ||
Maps [`fs.symlinkSync`](https://nodejs.org/api/fs.html#fs_fs_symlinksync_target_path_type). | ||
### writeFile(file, data[, options]) | ||
Maps [`fs.writeFileSync`](https://nodejs.org/api/fs.html#fs_fs_writefilesync_file_data_options). | ||
## License | ||
MIT © [Absolunet](https://absolunet.com) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
12716
91
231
1
+ Addedgraceful-fs@^4.1.11
- Removeddel@^3.0.0
- Removedarray-union@1.0.2(transitive)
- Removedarray-uniq@1.0.3(transitive)
- Removeddel@3.0.0(transitive)
- Removedfs.realpath@1.0.0(transitive)
- Removedglob@7.2.3(transitive)
- Removedglobby@6.1.0(transitive)
- Removedinflight@1.0.6(transitive)
- Removedinherits@2.0.4(transitive)
- Removedis-path-cwd@1.0.0(transitive)
- Removedis-path-in-cwd@1.0.1(transitive)
- Removedis-path-inside@1.0.1(transitive)
- Removedobject-assign@4.1.1(transitive)
- Removedonce@1.4.0(transitive)
- Removedp-map@1.2.0(transitive)
- Removedpath-is-absolute@1.0.1(transitive)
- Removedpath-is-inside@1.0.2(transitive)
- Removedpify@2.3.03.0.0(transitive)
- Removedpinkie@2.0.4(transitive)
- Removedpinkie-promise@2.0.1(transitive)
- Removedrimraf@2.7.1(transitive)
- Removedwrappy@1.0.2(transitive)