Gathering detailed insights and metrics for @node-kit/extra.fs
Gathering detailed insights and metrics for @node-kit/extra.fs
npm install @node-kit/extra.fs
Typescript
Module System
Node Version
NPM Version
87.9
Supply Chain
100
Quality
80.3
Maintenance
100
Vulnerability
100
License
TypeScript (93.53%)
JavaScript (6.37%)
Shell (0.1%)
Total Downloads
236,256
Last Day
1,503
Last Week
6,484
Last Month
23,776
Last Year
208,820
22 Stars
109 Commits
2 Forks
2 Watching
8 Branches
2 Contributors
Minified
Minified + Gzipped
Latest Version
3.3.1
Package Id
@node-kit/extra.fs@3.3.1
Unpacked Size
42.31 kB
Size
7.28 kB
File Count
7
NPM Version
10.8.2
Node Version
18.20.5
Publised On
26 Nov 2024
Cumulative downloads
Total Downloads
Last day
17.8%
1,503
Compared to previous day
Last week
-16.5%
6,484
Compared to previous week
Last month
-12.8%
23,776
Compared to previous month
Last year
661.1%
208,820
Compared to previous year
1
1# use pnpm 2$ pnpm install -D @node-kit/extra.fs 3 4# use yarn 5$ yarn add -D @node-kit/extra.fs 6 7# use npm 8$ npm install -D @node-kit/extra.fs
use import
1import { cp } from '@node-kit/extra.fs' 2 3cp()
use require
1const { cp } = require('@node-kit/extra.fs') 2 3cp()
copy files to new path
cp(path, target[, options])
& cpSync(path, target[, options])
Param | Description | Type | Optional value | Required | Default value |
---|---|---|---|---|---|
path | from path | PathLike | PathLike[] | - | true | - |
target | target path | PathLike | - | true | - |
options | copy options | CpOptions | - | false | {} |
1interface CpOptions extends RmDirOptions { 2 force?: boolean 3 silent?: boolean 4} 5 6declare function cp( 7 paths: PathLike | PathLike[], 8 target: PathLike, 9 options: CpOptions = { silent: true, force: true } 10): Promise<void> 11 12declare function cpSync( 13 paths: PathLike | PathLike[], 14 target: PathLike, 15 options: CpOptions = { silent: true, force: true } 16): void
1import { cp, cpSync } from '@node-kit/extra.fs' 2 3cp('./a', './b').then(() => { 4 console.log('copy done') 5}) 6// or 7cpSync('./a', './b')
1import { cp, cpSync } from '@node-kit/extra.fs' 2 3cp(['./a', './b'], './c').then(() => { 4 console.log('copy done') 5}) 6// or 7cpSync(['./a', './b'], './c')
remove files
rm(path[, options])
& rmSync(path[, options])
Param | Description | Type | Optional value | Required | Default value |
---|---|---|---|---|---|
path | from path | PathLike | PathLike[] | - | true | - |
options | remove options | RmOptions | - | false | {} |
1interface RmOptions extends RmDirOptions { 2 force?: boolean 3 silent?: boolean 4} 5 6declare function rm( 7 paths: PathLike | PathLike[], 8 options: RmOptions = { silent: true, force: true } 9): Promise<void> 10 11declare function rmSync( 12 paths: PathLike | PathLike[], 13 options: RmOptions = { silent: true, force: true } 14): void
1import { rm, rmSync } from '@node-kit/extra.fs' 2 3rm('./a', './b').then(() => { 4 console.log('remove done') 5}) 6// or 7rmSync('./a', './b')
1import { rm, rmSync } from '@node-kit/extra.fs' 2 3rm(['./a', './b']).then(() => { 4 console.log('remove done') 5}) 6// or 7rmSync(['./a', './b'])
move files to new path
mv(path, target[, options])
& mvSync(path, target[, options])
Param | Description | Type | Optional value | Required | Default value |
---|---|---|---|---|---|
path | from path | PathLike | PathLike[] | - | true | - |
target | target path | PathLike | - | true | - |
options | move options | MvOptions | - | false | {} |
1interface MvOptions extends RmDirOptions { 2 force?: boolean 3 boolean?: boolean 4} 5 6declare function mv( 7 paths: PathLike | PathLike[], 8 target: PathLike, 9 options: MvOptions = { silent: true, force: true } 10): Promise<void> 11 12declare function mvSync( 13 paths: PathLike | PathLike[], 14 target: PathLike, 15 options: MvOptions = { silent: true, force: true } 16): void
1import { mv, mvSync } from '@node-kit/extra.fs' 2 3mv('./a', './b').then(() => { 4 console.log('move done') 5}) 6// or 7mvSync('./a', './b')
1import { mv, mvSync } from '@node-kit/extra.fs' 2 3mv(['./a', './b'], './c').then(() => { 4 console.log('move done') 5}) 6// or 7mvSync(['./a', './b'], './c')
read json file
readJSON(path[, options])
& readJSONSync(path[, options])
Param | Description | Type | Optional value | Required | Default value |
---|---|---|---|---|---|
path | json path | PathLike | - | true | - |
options | read file options | ReadJSONOptions | ReadJSONSyncOptions | - | false | null |
1type ReadJSONOptions = Parameters<typeof promises.readFile>[1]
2
3type ReadJSONSyncOptions = Parameters<typeof promises.readFileSync>[1]
4
5declare function readJSON(
6 ...args: Parameters<typeof promises.readFile>
7): Promise<Record<string, unknown> | null>
8
9declare function readJSONSync(
10 ...args: Parameters<typeof readFileSync>
11): Record<string, unknown> | null
1import { readJSON, readJSONSync } from '@node-kit/extra.fs' 2 3readJSON('./a.json').then(data => { 4 console.log(data) 5}) 6// or 7const data = readJSONSync('./a.json')
write json to file
writeJSON(path, data[, options])
& writeJSONSync(path, data[, options])
Param | Description | Type | Optional value | Required | Default value |
---|---|---|---|---|---|
path | json path | PathLike | - | true | - |
data | json data | WriteJSONData | WriteJSONSyncData | - | true | - |
options | write file options | WriteFileOptions | - | false | null |
1type WriteJSONData = Record<string, unknown> | Parameters<typeof promises.writeFile>[1]
2
3type WriteJSONSyncData = Record<string, unknown> | Parameters<typeof promises.writeFileSync>[1]
4
5declare function writeJSON(
6 file: Parameters<typeof promises.writeFile>[0],
7 data: Record<string, unknown> | Parameters<typeof promises.writeFile>[1],
8 options?: WriteFileOptions
9): Promise<void>
10
11declare function writeJSONSync(
12 file: PathOrFileDescriptor,
13 data: Record<string, unknown> | Parameters<typeof writeFileSync>[1],
14 options?: WriteFileOptions
15): void
1import { writeJSON, writeJSONSync } from '@node-kit/extra.fs' 2 3writeJSON('./a.json', { name: 'saqqdy' }).then(data => { 4 console.log(data) 5}) 6// or 7const data = writeJSONSync('./a.json', { name: 'saqqdy' })
return the canonicalized absolute pathname
getRealPath(path)
& getRealPathSync(path)
Param | Description | Type | Optional value | Required | Default value |
---|---|---|---|---|---|
path | simple path | PathLike | - | true | - |
1declare function getRealPath(path: string): Promise<string>
2
3declare function getRealPathSync(path: string): string
1import { getRealPath, getRealPathSync } from '@node-kit/extra.fs' 2 3getRealPath('./a.json').then(data => { 4 console.log(data) 5}) 6// or 7const data = getRealPathSync('./a.json')
Please open an issue here.
No vulnerabilities found.
No security vulnerabilities found.