@magic/fs 0.0.37 → 0.0.39

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -338,7 +338,12 @@ update dependencies
338
338
 
339
339
  - update dependencies
340
340
 
341
- ##### 0.0.38 - unreleased
341
+ ##### 0.0.38
342
+
343
+ - update types
344
+ - update dependencies
345
+
346
+ ##### 0.0.39 - unreleased
342
347
 
343
348
  ...
344
349
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magic/fs",
3
- "version": "0.0.37",
3
+ "version": "0.0.39",
4
4
  "author": "Wizards & Witches",
5
5
  "description": "nodejs fs promises + goodies",
6
6
  "license": "AGPL-3.0",
@@ -21,10 +21,12 @@
21
21
  "prod": "NODE_ENV=production magic build serve",
22
22
  "clean": "magic clean",
23
23
  "serve": "magic serve",
24
- "dev": "magic dev"
24
+ "dev": "magic dev",
25
+ "tsc": "tsc --noEmit",
26
+ "check": "npm run tsc"
25
27
  },
26
28
  "engines": {
27
- "node": ">=14.15.4"
29
+ "node": ">=20.0.0"
28
30
  },
29
31
  "engineStrict": true,
30
32
  "repository": {
@@ -40,18 +42,18 @@
40
42
  "@magic-modules/no-spy": "0.0.9",
41
43
  "@magic-modules/pre": "0.0.12",
42
44
  "@magic-themes/docs": "0.0.15",
43
- "@magic/core": "0.0.156",
44
- "@magic/format": "0.0.68",
45
- "@magic/test": "0.2.25",
46
- "@types/node": "24.9.2",
47
- "typescript": "5.9.3"
45
+ "@magic/core": "0.0.158",
46
+ "@magic/format": "0.0.74",
47
+ "@magic/test": "0.3.19",
48
+ "@types/node": "26.0.1",
49
+ "typescript": "6.0.3"
48
50
  },
49
51
  "dependencies": {
50
- "@magic/deep": "0.1.20",
51
- "@magic/error": "0.0.21",
52
- "@magic/log": "0.1.21",
53
- "@magic/mime-types": "0.0.22",
54
- "@magic/types": "0.1.30"
52
+ "@magic/deep": "0.1.21",
53
+ "@magic/error": "0.0.23",
54
+ "@magic/log": "0.1.22",
55
+ "@magic/mime-types": "0.0.23",
56
+ "@magic/types": "0.1.37"
55
57
  },
56
58
  "files": [
57
59
  "src",
package/src/exists.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { fs } from './fs.js'
2
+ import { constants } from 'node:fs'
2
3
 
3
4
  import error from '@magic/error'
4
5
  import is from '@magic/types'
@@ -16,7 +17,7 @@ export const exists = async f => {
16
17
  }
17
18
 
18
19
  try {
19
- await fs.stat(f)
20
+ await fs.access(f, constants.F_OK)
20
21
  return true
21
22
  } catch (e) {
22
23
  const err = /** @type {Error & { code: string }} */ (e)
package/src/fs.js CHANGED
@@ -1,19 +1,24 @@
1
- import fso from 'node:fs'
2
- import util from 'node:util'
3
-
4
- const readDir = fso.promises.readdir
5
- const readFile = fso.promises.readFile
6
- const rmdir = fso.promises.rmdir
1
+ import fso, { constants } from 'node:fs'
2
+ import { access } from 'node:fs/promises'
7
3
 
8
4
  export const fs = /** @type {const} */ ({
9
5
  ...fso,
10
6
  ...fso.promises,
11
- exists: util.promisify(fso.exists),
12
- readdir: readDir,
13
- readDir,
14
- readFile,
15
- readfile: readFile,
16
- rmdir,
17
- rmDir: rmdir,
7
+ exists: async (/** @type {import('node:fs').PathLike} */ f) => {
8
+ try {
9
+ await access(f, constants.F_OK)
10
+ return true
11
+ } catch {
12
+ return false
13
+ }
14
+ },
15
+ readdir: fso.promises.readdir,
16
+ readDir: fso.promises.readdir,
17
+ readFile: fso.promises.readFile,
18
+ readfile: fso.promises.readFile,
19
+ rmdir: fso.promises.rmdir,
20
+ rmDir: fso.promises.rmdir,
18
21
  watch: fso.watch,
22
+ access,
23
+ constants,
19
24
  })
@@ -6,8 +6,6 @@ import error from '@magic/error'
6
6
 
7
7
  import { fs } from './fs.js'
8
8
 
9
- import { getFilePath } from './getFilePath.js'
10
-
11
9
  const libName = '@magic/fs.getDirectories'
12
10
 
13
11
  /**
@@ -28,10 +26,17 @@ export const getDirectories = async (dir, options = {}) => {
28
26
  }
29
27
  }
30
28
 
31
- let { minDepth, maxDepth = false, depth = false, root, noRoot = false } = options
29
+ let { minDepth, maxDepth = false, depth, root, noRoot = false } = options
30
+
31
+ // Only apply depth === false logic if explicitly passed, not if undefined
32
+ const depthExplicitlyFalse = 'depth' in options && depth === false
32
33
 
33
34
  if (!is.number(maxDepth)) {
34
- maxDepth = is.number(depth) ? depth : 200_000
35
+ if (depthExplicitlyFalse) {
36
+ maxDepth = 1
37
+ } else {
38
+ maxDepth = is.number(depth) ? depth : 200_000
39
+ }
35
40
  }
36
41
 
37
42
  if (!is.number(minDepth)) {
@@ -56,68 +61,44 @@ export const getDirectories = async (dir, options = {}) => {
56
61
 
57
62
  try {
58
63
  if (is.array(dir)) {
59
- const dirs = await Promise.all(dir.map(async f => await getDirectories(f, options)))
64
+ const dirs = await Promise.all(dir.map(f => getDirectories(f, options)))
60
65
 
61
66
  return deep.flatten(...dirs).filter(a => a)
62
67
  }
63
68
 
64
- const currentDepth = dir
65
- .replace(root || process.cwd(), '')
66
- .split(path.sep)
67
- .filter(a => a).length
68
-
69
- if (currentDepth > maxDepth) {
70
- return []
71
- }
72
-
73
- const dirContent = await fs.readdir(dir)
69
+ // Use recursive readdir with file types - single syscall, no per-file stat needed
70
+ const entries = await fs.readdir(dir, { recursive: true, withFileTypes: true })
74
71
 
75
72
  /** @type {string[]} */
76
73
  const dirs = []
77
74
 
78
- await Promise.all(
79
- dirContent.map(async file => {
80
- if (!is.string(file)) {
81
- throw error(`${libName}: path was not a string: ${file}`, 'E_ARG_TYPE')
82
- }
75
+ if (!noRoot) {
76
+ // Root dir is depth 0
77
+ if (0 >= minDepth && 0 <= maxDepth) {
78
+ dirs.push(dir)
79
+ }
80
+ }
83
81
 
84
- let filePath = await getFilePath(getDirectories, dir, file, { maxDepth, minDepth, root })
85
-
86
- if (filePath) {
87
- if (!is.array(filePath)) {
88
- filePath = [filePath]
89
- }
90
-
91
- await Promise.all(
92
- filePath.map(async file => {
93
- try {
94
- const stat = await fs.stat(file)
95
- if (stat.isDirectory()) {
96
- if (is.array(filePath)) {
97
- dirs.push(...filePath)
98
- } else if (is.string(filePath)) {
99
- dirs.push(filePath)
100
- }
101
- }
102
- } catch (statErr) {
103
- // File might have been deleted between readdir and stat
104
- // Just skip it
105
- }
106
- }),
107
- )
108
- }
109
- }),
110
- )
82
+ for (const entry of entries) {
83
+ if (entry.isDirectory()) {
84
+ // Use parentPath + name for correct full path with recursive readdir
85
+ const fullPath = path.join(entry.parentPath, entry.name)
111
86
 
112
- let finalDirs = deep.flatten(dirs).filter(a => a)
113
- if (!noRoot) {
114
- finalDirs = [dir, ...finalDirs]
87
+ // Calculate depth relative to root
88
+ const relativePath = path.relative(root || dir, fullPath)
89
+ const entryDepth = relativePath.split(path.sep).filter(Boolean).length
90
+
91
+ // Filter by minDepth and maxDepth
92
+ if (entryDepth >= minDepth && entryDepth <= maxDepth) {
93
+ dirs.push(fullPath)
94
+ }
95
+ }
115
96
  }
116
97
 
117
- const finalized = finalDirs
98
+ const finalized = dirs
118
99
  .filter(a => is.string(a))
119
- .filter(dir => {
120
- const currentDepth = dir
100
+ .filter(d => {
101
+ const currentDepth = d
121
102
  .replace(root || process.cwd(), '')
122
103
  .split(path.sep)
123
104
  .filter(a => a).length
@@ -39,10 +39,17 @@ export const getFilePath = async (fn, dir, file, args = {}) => {
39
39
 
40
40
  const filePath = path.join(dir, file)
41
41
 
42
- const stat = await fs.stat(filePath)
43
- if (stat.isDirectory()) {
42
+ // Use readdir with withFileTypes - more efficient than stat
43
+ const entries = await fs.readdir(dir, { withFileTypes: true })
44
+ const entry = entries.find(e => e.name === file)
45
+
46
+ if (!entry) {
47
+ return undefined
48
+ }
49
+
50
+ if (entry.isDirectory()) {
44
51
  return await fn(filePath, args)
45
- } else if (stat.isFile()) {
52
+ } else if (entry.isFile()) {
46
53
  return filePath
47
54
  }
48
55
  }
package/src/getFiles.js CHANGED
@@ -1,10 +1,8 @@
1
1
  import path from 'node:path'
2
2
 
3
- // import deep from '@magic/deep'
4
3
  import is from '@magic/types'
5
4
  import error from '@magic/error'
6
5
 
7
- import { getFilePath } from './getFilePath.js'
8
6
  import { fs } from './fs.js'
9
7
 
10
8
  const libName = '@magic/fs.getFiles'
@@ -54,60 +52,42 @@ export const getFiles = async (dir, options = {}) => {
54
52
  root = dir
55
53
  }
56
54
 
57
- const currentDepth = dir
58
- .replace(root, '')
59
- .split(path.sep)
60
- .filter(a => a).length
61
-
62
- if (currentDepth > maxDepth) {
63
- return []
64
- }
65
-
66
55
  try {
67
- const dirContent = await fs.readdir(dir)
68
- const files = await Promise.all(
69
- dirContent.map(file => getFilePath(getFiles, dir, file, { maxDepth, minDepth, root })),
70
- )
71
-
72
- const flatFiles = files
73
- .flat(20000)
74
- .filter(a => !is.undef(a))
75
- /*
76
- * if an extension parameter has been passed,
77
- * remove the file if it does not end with extension
78
- */
79
- .filter(a => !extension || a.endsWith(extension))
80
-
81
- /*
82
- * filter nonfiles - use async stat
83
- */
84
- const fileStats = await Promise.all(
85
- flatFiles.map(async f => {
86
- try {
87
- const stat = await fs.stat(f)
88
- return { path: f, isFile: stat.isFile() }
89
- } catch {
90
- return { path: f, isFile: false }
91
- }
92
- }),
93
- )
56
+ // Use recursive readdir with file types - single syscall, no per-file stat needed
57
+ const entries = await fs.readdir(dir, { recursive: true, withFileTypes: true })
94
58
 
95
59
  return (
96
- fileStats
97
- .filter(({ isFile }) => isFile)
98
- .map(({ path }) => path)
99
- /*
100
- * filter files if depth is smaller than minDepth
101
- */
102
- .filter(file => {
103
- const currentDepth =
104
- file
105
- .replace(root ?? '', '')
106
- .split(path.sep)
107
- .filter(a => a).length - 1
108
-
109
- return currentDepth >= minDepth
60
+ entries
61
+ .filter(entry => {
62
+ // Only files
63
+ if (!entry.isFile()) {
64
+ return false
65
+ }
66
+
67
+ // Calculate depth relative to root - based on parent directory, not file name
68
+ const parentPath = path.join(entry.parentPath)
69
+ const relativePath = path.relative(root, parentPath)
70
+ const entryDepth = relativePath.split(path.sep).filter(Boolean).length
71
+
72
+ // Filter by maxDepth
73
+ if (entryDepth > maxDepth) {
74
+ return false
75
+ }
76
+
77
+ // Filter by minDepth
78
+ if (entryDepth < minDepth) {
79
+ return false
80
+ }
81
+
82
+ // Filter by extension
83
+ if (extension && !relativePath.endsWith(extension)) {
84
+ return false
85
+ }
86
+
87
+ return true
110
88
  })
89
+ // Use parentPath + name for correct full path with recursive readdir
90
+ .map(entry => path.join(entry.parentPath, entry.name))
111
91
  )
112
92
  } catch (e) {
113
93
  const err = /** @type {Error & { code?: string }} */ (e)
package/src/mkdirp.js CHANGED
@@ -1,18 +1,17 @@
1
- import path from 'path'
2
-
3
- import error from '@magic/error'
4
1
  import is from '@magic/types'
5
-
6
2
  import { fs } from './fs.js'
3
+ import error from '@magic/error'
7
4
 
8
5
  const libName = '@magic/fs.mkdirp'
9
6
 
10
7
  /**
11
8
  *
12
- * @param {string} p
13
- * @returns {Promise<boolean | void>}
9
+ * @param {import('node:fs').PathLike} p
10
+ * @param {import('node:fs').MakeDirectoryOptions} opts
11
+ *
12
+ * @returns {Promise<boolean>}
14
13
  */
15
- export const mkdirp = async p => {
14
+ export const mkdirp = async (p, opts = {}) => {
16
15
  if (is.empty(p)) {
17
16
  throw error(`${libName} expects a non-empty path string as argument.`, 'E_ARG_EMPTY')
18
17
  }
@@ -21,17 +20,8 @@ export const mkdirp = async p => {
21
20
  throw error(`${libName} expects a path string as argument, got: ${typeof p}`, 'E_ARG_TYPE')
22
21
  }
23
22
 
24
- p = path.resolve(p)
25
-
26
23
  try {
27
- const dir = path.dirname(p)
28
- let exists = await fs.exists(dir)
29
-
30
- if (!exists) {
31
- await mkdirp(dir)
32
- }
33
-
34
- await fs.mkdir(p)
24
+ await fs.mkdir(p, { ...opts, recursive: true })
35
25
  return true
36
26
  } catch (e) {
37
27
  const err = /** @type {Error & { code?: string}} */ (e)
package/src/rmrf.js CHANGED
@@ -1,4 +1,4 @@
1
- import path from 'path'
1
+ import path from 'node:path'
2
2
 
3
3
  import is from '@magic/types'
4
4
  import error from '@magic/error'
@@ -36,23 +36,10 @@ export const rmrf = async (dir, opts = {}) => {
36
36
  }
37
37
 
38
38
  try {
39
- const stat = await fs.stat(dir)
40
-
41
- if (stat.isFile()) {
42
- if (!opts.dryRun) {
43
- await fs.unlink(dir)
44
- }
45
- return true
46
- } else if (stat.isDirectory()) {
47
- const files = await fs.readdir(dir)
48
-
49
- await Promise.all(files.map(async file => await rmrf(path.join(dir, file))))
50
-
51
- if (!opts.dryRun) {
52
- await fs.rmdir(dir)
53
- }
54
- return true
39
+ if (!opts.dryRun) {
40
+ await fs.rm(dir, { recursive: true, force: true })
55
41
  }
42
+ return true
56
43
  } catch (e) {
57
44
  const err = /** @type {Error & { code?: string}} */ (e)
58
45
 
package/types/fs.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export const fs: {
2
- readonly exists: typeof fso.exists.__promisify__
2
+ readonly exists: (f: import('node:fs').PathLike) => Promise<boolean>
3
3
  readonly readdir: typeof fso.promises.readdir
4
4
  readonly readDir: typeof fso.promises.readdir
5
5
  readonly readFile: typeof fso.promises.readFile
@@ -8,6 +8,7 @@ export const fs: {
8
8
  readonly rmDir: typeof fso.promises.rmdir
9
9
  readonly watch: typeof fso.watch
10
10
  readonly access: typeof fso.promises.access
11
+ readonly constants: typeof fso.constants
11
12
  readonly copyFile: typeof fso.promises.copyFile
12
13
  readonly open: typeof fso.promises.open
13
14
  readonly rename: typeof fso.promises.rename
@@ -35,7 +36,6 @@ export const fs: {
35
36
  readonly opendir: typeof fso.promises.opendir
36
37
  readonly cp: typeof fso.promises.cp
37
38
  readonly glob: typeof fso.promises.glob
38
- readonly constants: typeof fso.constants
39
39
  readonly renameSync: typeof fso.renameSync
40
40
  readonly truncateSync: typeof fso.truncateSync
41
41
  readonly ftruncate: typeof fso.ftruncate
@@ -49,9 +49,11 @@ export const fs: {
49
49
  readonly fchmod: typeof fso.fchmod
50
50
  readonly fchmodSync: typeof fso.fchmodSync
51
51
  readonly lchmodSync: typeof fso.lchmodSync
52
+ readonly statSync: typeof fso.statSync
52
53
  readonly fstat: typeof fso.fstat
53
54
  readonly fstatSync: typeof fso.fstatSync
54
55
  readonly statfsSync: typeof fso.statfsSync
56
+ readonly lstatSync: typeof fso.lstatSync
55
57
  readonly linkSync: typeof fso.linkSync
56
58
  readonly symlinkSync: typeof fso.symlinkSync
57
59
  readonly readlinkSync: typeof fso.readlinkSync
@@ -95,7 +97,6 @@ export const fs: {
95
97
  readonly opendirSync: typeof fso.opendirSync
96
98
  readonly cpSync: typeof fso.cpSync
97
99
  readonly globSync: typeof fso.globSync
98
- readonly promises: typeof fso.promises
99
100
  readonly Stats: typeof fso.Stats
100
101
  readonly StatsFs: typeof fso.StatsFs
101
102
  readonly Dirent: typeof fso.Dirent
@@ -103,7 +104,6 @@ export const fs: {
103
104
  readonly ReadStream: typeof fso.ReadStream
104
105
  readonly Utf8Stream: typeof fso.Utf8Stream
105
106
  readonly WriteStream: typeof fso.WriteStream
106
- readonly statSync: fso.StatSyncFn
107
- readonly lstatSync: fso.StatSyncFn
107
+ readonly promises: typeof fso.promises
108
108
  }
109
109
  import fso from 'node:fs'
package/types/index.d.ts CHANGED
@@ -1,5 +1,8 @@
1
1
  export const fs: {
2
- readonly mkdirp: (p: string) => Promise<boolean | void>
2
+ readonly mkdirp: (
3
+ p: import('node:fs').PathLike,
4
+ opts?: import('node:fs').MakeDirectoryOptions,
5
+ ) => Promise<boolean>
3
6
  readonly rmrf: (
4
7
  dir: string,
5
8
  opts?: {
@@ -33,7 +36,7 @@ export const fs: {
33
36
  root?: string
34
37
  },
35
38
  ) => Promise<string[]>
36
- readonly exists: (f: import('fs').PathLike) => Promise<boolean>
39
+ readonly exists: (f: import('node:fs').PathLike) => Promise<boolean>
37
40
  readonly getContentType: (uri: string) => string
38
41
  readonly getFilePath: (
39
42
  fn:
@@ -76,110 +79,110 @@ export const fs: {
76
79
  root?: string
77
80
  },
78
81
  ) => Promise<string | string[] | undefined>
79
- readonly readdir: typeof import('fs/promises').readdir
80
- readonly readDir: typeof import('fs/promises').readdir
81
- readonly readFile: typeof import('fs/promises').readFile
82
- readonly readfile: typeof import('fs/promises').readFile
83
- readonly rmdir: typeof import('fs/promises').rmdir
84
- readonly rmDir: typeof import('fs/promises').rmdir
85
- readonly watch: typeof import('fs').watch
86
- readonly access: typeof import('fs/promises').access
87
- readonly copyFile: typeof import('fs/promises').copyFile
88
- readonly open: typeof import('fs/promises').open
89
- readonly rename: typeof import('fs/promises').rename
90
- readonly truncate: typeof import('fs/promises').truncate
91
- readonly rm: typeof import('fs/promises').rm
92
- readonly mkdir: typeof import('fs/promises').mkdir
93
- readonly readlink: typeof import('fs/promises').readlink
94
- readonly symlink: typeof import('fs/promises').symlink
95
- readonly lstat: typeof import('fs/promises').lstat
96
- readonly stat: typeof import('fs/promises').stat
97
- readonly statfs: typeof import('fs/promises').statfs
98
- readonly link: typeof import('fs/promises').link
99
- readonly unlink: typeof import('fs/promises').unlink
100
- readonly chmod: typeof import('fs/promises').chmod
101
- readonly lchmod: typeof import('fs/promises').lchmod
102
- readonly lchown: typeof import('fs/promises').lchown
103
- readonly lutimes: typeof import('fs/promises').lutimes
104
- readonly chown: typeof import('fs/promises').chown
105
- readonly utimes: typeof import('fs/promises').utimes
106
- readonly realpath: typeof import('fs/promises').realpath
107
- readonly mkdtemp: typeof import('fs/promises').mkdtemp
108
- readonly mkdtempDisposable: typeof import('fs/promises').mkdtempDisposable
109
- readonly writeFile: typeof import('fs/promises').writeFile
110
- readonly appendFile: typeof import('fs/promises').appendFile
111
- readonly opendir: typeof import('fs/promises').opendir
112
- readonly cp: typeof import('fs/promises').cp
113
- readonly glob: typeof import('fs/promises').glob
114
- readonly constants: typeof import('fs').constants
115
- readonly renameSync: typeof import('fs').renameSync
116
- readonly truncateSync: typeof import('fs').truncateSync
117
- readonly ftruncate: typeof import('fs').ftruncate
118
- readonly ftruncateSync: typeof import('fs').ftruncateSync
119
- readonly chownSync: typeof import('fs').chownSync
120
- readonly fchown: typeof import('fs').fchown
121
- readonly fchownSync: typeof import('fs').fchownSync
122
- readonly lchownSync: typeof import('fs').lchownSync
123
- readonly lutimesSync: typeof import('fs').lutimesSync
124
- readonly chmodSync: typeof import('fs').chmodSync
125
- readonly fchmod: typeof import('fs').fchmod
126
- readonly fchmodSync: typeof import('fs').fchmodSync
127
- readonly lchmodSync: typeof import('fs').lchmodSync
128
- readonly fstat: typeof import('fs').fstat
129
- readonly fstatSync: typeof import('fs').fstatSync
130
- readonly statfsSync: typeof import('fs').statfsSync
131
- readonly linkSync: typeof import('fs').linkSync
132
- readonly symlinkSync: typeof import('fs').symlinkSync
133
- readonly readlinkSync: typeof import('fs').readlinkSync
134
- readonly realpathSync: typeof import('fs').realpathSync
135
- readonly unlinkSync: typeof import('fs').unlinkSync
136
- readonly rmdirSync: typeof import('fs').rmdirSync
137
- readonly rmSync: typeof import('fs').rmSync
138
- readonly mkdirSync: typeof import('fs').mkdirSync
139
- readonly mkdtempSync: typeof import('fs').mkdtempSync
140
- readonly mkdtempDisposableSync: typeof import('fs').mkdtempDisposableSync
141
- readonly readdirSync: typeof import('fs').readdirSync
142
- readonly close: typeof import('fs').close
143
- readonly closeSync: typeof import('fs').closeSync
144
- readonly openSync: typeof import('fs').openSync
145
- readonly utimesSync: typeof import('fs').utimesSync
146
- readonly futimes: typeof import('fs').futimes
147
- readonly futimesSync: typeof import('fs').futimesSync
148
- readonly fsync: typeof import('fs').fsync
149
- readonly fsyncSync: typeof import('fs').fsyncSync
150
- readonly write: typeof import('fs').write
151
- readonly writeSync: typeof import('fs').writeSync
152
- readonly read: typeof import('fs').read
153
- readonly readSync: typeof import('fs').readSync
154
- readonly readFileSync: typeof import('fs').readFileSync
155
- readonly writeFileSync: typeof import('fs').writeFileSync
156
- readonly appendFileSync: typeof import('fs').appendFileSync
157
- readonly watchFile: typeof import('fs').watchFile
158
- readonly unwatchFile: typeof import('fs').unwatchFile
159
- readonly existsSync: typeof import('fs').existsSync
160
- readonly accessSync: typeof import('fs').accessSync
161
- readonly createReadStream: typeof import('fs').createReadStream
162
- readonly createWriteStream: typeof import('fs').createWriteStream
163
- readonly fdatasync: typeof import('fs').fdatasync
164
- readonly fdatasyncSync: typeof import('fs').fdatasyncSync
165
- readonly copyFileSync: typeof import('fs').copyFileSync
166
- readonly writev: typeof import('fs').writev
167
- readonly writevSync: typeof import('fs').writevSync
168
- readonly readv: typeof import('fs').readv
169
- readonly readvSync: typeof import('fs').readvSync
170
- readonly openAsBlob: typeof import('fs').openAsBlob
171
- readonly opendirSync: typeof import('fs').opendirSync
172
- readonly cpSync: typeof import('fs').cpSync
173
- readonly globSync: typeof import('fs').globSync
82
+ readonly readdir: typeof import('node:fs/promises').readdir
83
+ readonly readDir: typeof import('node:fs/promises').readdir
84
+ readonly readFile: typeof import('node:fs/promises').readFile
85
+ readonly readfile: typeof import('node:fs/promises').readFile
86
+ readonly rmdir: typeof import('node:fs/promises').rmdir
87
+ readonly rmDir: typeof import('node:fs/promises').rmdir
88
+ readonly watch: typeof import('node:fs').watch
89
+ readonly access: typeof import('node:fs/promises').access
90
+ readonly constants: typeof import('node:fs').constants
91
+ readonly copyFile: typeof import('node:fs/promises').copyFile
92
+ readonly open: typeof import('node:fs/promises').open
93
+ readonly rename: typeof import('node:fs/promises').rename
94
+ readonly truncate: typeof import('node:fs/promises').truncate
95
+ readonly rm: typeof import('node:fs/promises').rm
96
+ readonly mkdir: typeof import('node:fs/promises').mkdir
97
+ readonly readlink: typeof import('node:fs/promises').readlink
98
+ readonly symlink: typeof import('node:fs/promises').symlink
99
+ readonly lstat: typeof import('node:fs/promises').lstat
100
+ readonly stat: typeof import('node:fs/promises').stat
101
+ readonly statfs: typeof import('node:fs/promises').statfs
102
+ readonly link: typeof import('node:fs/promises').link
103
+ readonly unlink: typeof import('node:fs/promises').unlink
104
+ readonly chmod: typeof import('node:fs/promises').chmod
105
+ readonly lchmod: typeof import('node:fs/promises').lchmod
106
+ readonly lchown: typeof import('node:fs/promises').lchown
107
+ readonly lutimes: typeof import('node:fs/promises').lutimes
108
+ readonly chown: typeof import('node:fs/promises').chown
109
+ readonly utimes: typeof import('node:fs/promises').utimes
110
+ readonly realpath: typeof import('node:fs/promises').realpath
111
+ readonly mkdtemp: typeof import('node:fs/promises').mkdtemp
112
+ readonly mkdtempDisposable: typeof import('node:fs/promises').mkdtempDisposable
113
+ readonly writeFile: typeof import('node:fs/promises').writeFile
114
+ readonly appendFile: typeof import('node:fs/promises').appendFile
115
+ readonly opendir: typeof import('node:fs/promises').opendir
116
+ readonly cp: typeof import('node:fs/promises').cp
117
+ readonly glob: typeof import('node:fs/promises').glob
118
+ readonly renameSync: typeof import('node:fs').renameSync
119
+ readonly truncateSync: typeof import('node:fs').truncateSync
120
+ readonly ftruncate: typeof import('node:fs').ftruncate
121
+ readonly ftruncateSync: typeof import('node:fs').ftruncateSync
122
+ readonly chownSync: typeof import('node:fs').chownSync
123
+ readonly fchown: typeof import('node:fs').fchown
124
+ readonly fchownSync: typeof import('node:fs').fchownSync
125
+ readonly lchownSync: typeof import('node:fs').lchownSync
126
+ readonly lutimesSync: typeof import('node:fs').lutimesSync
127
+ readonly chmodSync: typeof import('node:fs').chmodSync
128
+ readonly fchmod: typeof import('node:fs').fchmod
129
+ readonly fchmodSync: typeof import('node:fs').fchmodSync
130
+ readonly lchmodSync: typeof import('node:fs').lchmodSync
131
+ readonly statSync: typeof import('node:fs').statSync
132
+ readonly fstat: typeof import('node:fs').fstat
133
+ readonly fstatSync: typeof import('node:fs').fstatSync
134
+ readonly statfsSync: typeof import('node:fs').statfsSync
135
+ readonly lstatSync: typeof import('node:fs').lstatSync
136
+ readonly linkSync: typeof import('node:fs').linkSync
137
+ readonly symlinkSync: typeof import('node:fs').symlinkSync
138
+ readonly readlinkSync: typeof import('node:fs').readlinkSync
139
+ readonly realpathSync: typeof import('node:fs').realpathSync
140
+ readonly unlinkSync: typeof import('node:fs').unlinkSync
141
+ readonly rmdirSync: typeof import('node:fs').rmdirSync
142
+ readonly rmSync: typeof import('node:fs').rmSync
143
+ readonly mkdirSync: typeof import('node:fs').mkdirSync
144
+ readonly mkdtempSync: typeof import('node:fs').mkdtempSync
145
+ readonly mkdtempDisposableSync: typeof import('node:fs').mkdtempDisposableSync
146
+ readonly readdirSync: typeof import('node:fs').readdirSync
147
+ readonly close: typeof import('node:fs').close
148
+ readonly closeSync: typeof import('node:fs').closeSync
149
+ readonly openSync: typeof import('node:fs').openSync
150
+ readonly utimesSync: typeof import('node:fs').utimesSync
151
+ readonly futimes: typeof import('node:fs').futimes
152
+ readonly futimesSync: typeof import('node:fs').futimesSync
153
+ readonly fsync: typeof import('node:fs').fsync
154
+ readonly fsyncSync: typeof import('node:fs').fsyncSync
155
+ readonly write: typeof import('node:fs').write
156
+ readonly writeSync: typeof import('node:fs').writeSync
157
+ readonly read: typeof import('node:fs').read
158
+ readonly readSync: typeof import('node:fs').readSync
159
+ readonly readFileSync: typeof import('node:fs').readFileSync
160
+ readonly writeFileSync: typeof import('node:fs').writeFileSync
161
+ readonly appendFileSync: typeof import('node:fs').appendFileSync
162
+ readonly watchFile: typeof import('node:fs').watchFile
163
+ readonly unwatchFile: typeof import('node:fs').unwatchFile
164
+ readonly existsSync: typeof import('node:fs').existsSync
165
+ readonly accessSync: typeof import('node:fs').accessSync
166
+ readonly createReadStream: typeof import('node:fs').createReadStream
167
+ readonly createWriteStream: typeof import('node:fs').createWriteStream
168
+ readonly fdatasync: typeof import('node:fs').fdatasync
169
+ readonly fdatasyncSync: typeof import('node:fs').fdatasyncSync
170
+ readonly copyFileSync: typeof import('node:fs').copyFileSync
171
+ readonly writev: typeof import('node:fs').writev
172
+ readonly writevSync: typeof import('node:fs').writevSync
173
+ readonly readv: typeof import('node:fs').readv
174
+ readonly readvSync: typeof import('node:fs').readvSync
175
+ readonly openAsBlob: typeof import('node:fs').openAsBlob
176
+ readonly opendirSync: typeof import('node:fs').opendirSync
177
+ readonly cpSync: typeof import('node:fs').cpSync
178
+ readonly globSync: typeof import('node:fs').globSync
179
+ readonly Stats: typeof import('node:fs').Stats
180
+ readonly StatsFs: typeof import('node:fs').StatsFs
181
+ readonly Dirent: typeof import('node:fs').Dirent
182
+ readonly Dir: typeof import('node:fs').Dir
183
+ readonly ReadStream: typeof import('node:fs').ReadStream
184
+ readonly Utf8Stream: typeof import('node:fs').Utf8Stream
185
+ readonly WriteStream: typeof import('node:fs').WriteStream
174
186
  readonly promises: typeof import('node:fs/promises')
175
- readonly Stats: typeof import('fs').Stats
176
- readonly StatsFs: typeof import('fs').StatsFs
177
- readonly Dirent: typeof import('fs').Dirent
178
- readonly Dir: typeof import('fs').Dir
179
- readonly ReadStream: typeof import('fs').ReadStream
180
- readonly Utf8Stream: typeof import('fs').Utf8Stream
181
- readonly WriteStream: typeof import('fs').WriteStream
182
- readonly statSync: import('fs').StatSyncFn
183
- readonly lstatSync: import('fs').StatSyncFn
184
187
  }
185
188
  export default fs
package/types/mkdirp.d.ts CHANGED
@@ -1 +1,4 @@
1
- export function mkdirp(p: string): Promise<boolean | void>
1
+ export function mkdirp(
2
+ p: import('node:fs').PathLike,
3
+ opts?: import('node:fs').MakeDirectoryOptions,
4
+ ): Promise<boolean>