@tachybase/module-file 1.3.24 → 1.3.25

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.
@@ -1 +1 @@
1
- {"_from":"multer-cos","_id":"multer-cos@1.0.2","_inBundle":false,"_integrity":"sha512-4F8P1VTCSNhiem+BFJFLe3Ixco6cIuAQ6j7U+PBRvdbBJRZgq5Q+vaDMMBWJ1HmPGOOP3AyKS5yk2f0nbFoqqA==","_location":"/multer-cos","_phantomChildren":{},"_requested":{"type":"tag","registry":true,"raw":"multer-cos","name":"multer-cos","escapedName":"multer-cos","rawSpec":"","saveSpec":null,"fetchSpec":"latest"},"_requiredBy":["#USER","/"],"_resolved":"https://registry.npmjs.org/multer-cos/-/multer-cos-1.0.2.tgz","_shasum":"95c7c06cdee1b9311675a895481f9d946de6dcf3","_spec":"multer-cos","_where":"/Users/lanbo/workplace/websocket","author":{"name":"lanbosm"},"bugs":{"url":"https://github.com/lanbosm/multer-COS/issues"},"bundleDependencies":false,"deprecated":false,"description":"Streaming multer storage engine for QCloud COS","devDependencies":{"cos-nodejs-sdk-v5":"^2.2.6","dotenv":"^5.0.1","multer":"^1.3.0"},"engines":{"node":">= 6.10.0"},"homepage":"https://github.com/lanbosm/multer-COS#readme","keywords":["express","multer","COS"],"license":"MIT","main":"index.js","name":"multer-cos","repository":{"type":"git","url":"git+ssh://git@github.com/lanbosm/multer-COS.git"},"scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"version":"1.0.3","_lastModified":"2025-08-03T23:04:19.227Z"}
1
+ {"_from":"multer-cos","_id":"multer-cos@1.0.2","_inBundle":false,"_integrity":"sha512-4F8P1VTCSNhiem+BFJFLe3Ixco6cIuAQ6j7U+PBRvdbBJRZgq5Q+vaDMMBWJ1HmPGOOP3AyKS5yk2f0nbFoqqA==","_location":"/multer-cos","_phantomChildren":{},"_requested":{"type":"tag","registry":true,"raw":"multer-cos","name":"multer-cos","escapedName":"multer-cos","rawSpec":"","saveSpec":null,"fetchSpec":"latest"},"_requiredBy":["#USER","/"],"_resolved":"https://registry.npmjs.org/multer-cos/-/multer-cos-1.0.2.tgz","_shasum":"95c7c06cdee1b9311675a895481f9d946de6dcf3","_spec":"multer-cos","_where":"/Users/lanbo/workplace/websocket","author":{"name":"lanbosm"},"bugs":{"url":"https://github.com/lanbosm/multer-COS/issues"},"bundleDependencies":false,"deprecated":false,"description":"Streaming multer storage engine for QCloud COS","devDependencies":{"cos-nodejs-sdk-v5":"^2.2.6","dotenv":"^5.0.1","multer":"^1.3.0"},"engines":{"node":">= 6.10.0"},"homepage":"https://github.com/lanbosm/multer-COS#readme","keywords":["express","multer","COS"],"license":"MIT","main":"index.js","name":"multer-cos","repository":{"type":"git","url":"git+ssh://git@github.com/lanbosm/multer-COS.git"},"scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"version":"1.0.3","_lastModified":"2025-09-02T09:51:47.771Z"}
@@ -1 +1 @@
1
- {"name":"multer-s3","version":"3.0.1","description":"Streaming multer storage engine for AWS S3","main":"index.js","scripts":{"test":"standard && mocha test/basic.js"},"engines":{"node":">= 12.0.0"},"repository":{"type":"git","url":"git+https://github.com/badunk/multer-s3.git"},"keywords":["multer","s3","amazon","aws"],"author":"badunk","license":"MIT","bugs":{"url":"https://github.com/badunk/multer-s3/issues"},"homepage":"https://github.com/badunk/multer-s3#readme","dependencies":{"@aws-sdk/lib-storage":"^3.46.0","file-type":"^3.3.0","html-comment-regex":"^1.1.2","run-parallel":"^1.1.6"},"peerDependencies":{"@aws-sdk/client-s3":"^3.0.0"},"devDependencies":{"express":"^4.13.1","form-data":"^1.0.0-rc3","mocha":"^2.2.5","multer":"^1.1.0","on-finished":"^2.3.0","standard":"^5.4.1","xtend":"^4.0.1"},"_lastModified":"2025-08-03T23:04:15.398Z"}
1
+ {"name":"multer-s3","version":"3.0.1","description":"Streaming multer storage engine for AWS S3","main":"index.js","scripts":{"test":"standard && mocha test/basic.js"},"engines":{"node":">= 12.0.0"},"repository":{"type":"git","url":"git+https://github.com/badunk/multer-s3.git"},"keywords":["multer","s3","amazon","aws"],"author":"badunk","license":"MIT","bugs":{"url":"https://github.com/badunk/multer-s3/issues"},"homepage":"https://github.com/badunk/multer-s3#readme","dependencies":{"@aws-sdk/lib-storage":"^3.46.0","file-type":"^3.3.0","html-comment-regex":"^1.1.2","run-parallel":"^1.1.6"},"peerDependencies":{"@aws-sdk/client-s3":"^3.0.0"},"devDependencies":{"express":"^4.13.1","form-data":"^1.0.0-rc3","mocha":"^2.2.5","multer":"^1.1.0","on-finished":"^2.3.0","standard":"^5.4.1","xtend":"^4.0.1"},"_lastModified":"2025-09-02T09:51:43.657Z"}
@@ -30,9 +30,9 @@ __export(local_exports, {
30
30
  default: () => local_default
31
31
  });
32
32
  module.exports = __toCommonJS(local_exports);
33
+ var import_node_fs = require("node:fs");
33
34
  var import_promises = __toESM(require("node:fs/promises"));
34
35
  var import_node_path = __toESM(require("node:path"));
35
- var import_mkdirp = __toESM(require("mkdirp"));
36
36
  var import_multer = __toESM(require("multer"));
37
37
  var import_constants = require("../constants");
38
38
  var import_utils = require("../utils");
@@ -47,7 +47,7 @@ var local_default = {
47
47
  return import_multer.default.diskStorage({
48
48
  destination: function(req, file, cb) {
49
49
  const destPath = import_node_path.default.join(getDocumentRoot(storage), storage.path);
50
- (0, import_mkdirp.default)(destPath, (err) => cb(err, destPath));
50
+ (0, import_node_fs.mkdir)(destPath, { recursive: true }, (err) => cb(err, destPath));
51
51
  },
52
52
  filename: import_utils.getFilename
53
53
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tachybase/module-file",
3
3
  "displayName": "File manager",
4
- "version": "1.3.24",
4
+ "version": "1.3.25",
5
5
  "description": "Provides files storage services with files collection template and attachment field.",
6
6
  "keywords": [
7
7
  "Collections",
@@ -13,10 +13,10 @@
13
13
  "devDependencies": {
14
14
  "@ant-design/icons": "^5.6.1",
15
15
  "@aws-sdk/client-s3": "^3.850.0",
16
- "@tachybase/schema": "^1.3.49",
17
- "@tachybase/test": "^1.3.49",
18
- "@tego/client": "^1.3.49",
19
- "@tego/server": "^1.3.49",
16
+ "@tachybase/schema": "*",
17
+ "@tachybase/test": "*",
18
+ "@tego/client": "*",
19
+ "@tego/server": "*",
20
20
  "@types/koa-multer": "^1.0.4",
21
21
  "@types/multer": "^1.4.12",
22
22
  "antd": "5.22.5",
@@ -24,7 +24,6 @@
24
24
  "koa-static": "^5.0.0",
25
25
  "lodash": "4.17.21",
26
26
  "mime-match": "^1.0.2",
27
- "mkdirp": "^1.0.4",
28
27
  "multer": "2.0.1",
29
28
  "multer-aliyun-oss": "2.1.3",
30
29
  "multer-cos": "^1.0.3",
@@ -32,7 +31,7 @@
32
31
  "react": "18.3.1",
33
32
  "react-i18next": "15.2.0",
34
33
  "supertest": "^7.1.3",
35
- "@tachybase/client": "1.3.24"
34
+ "@tachybase/client": "1.3.25"
36
35
  },
37
36
  "description.zh-CN": "提供文件存储服务,并提供了文件表模板和附件字段。",
38
37
  "displayName.zh-CN": "文件管理器",
@@ -1,21 +0,0 @@
1
- Copyright James Halliday (mail@substack.net) and Isaac Z. Schlueter (i@izs.me)
2
-
3
- This project is free software released under the MIT license:
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
@@ -1,68 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- const usage = () => `
4
- usage: mkdirp [DIR1,DIR2..] {OPTIONS}
5
-
6
- Create each supplied directory including any necessary parent directories
7
- that don't yet exist.
8
-
9
- If the directory already exists, do nothing.
10
-
11
- OPTIONS are:
12
-
13
- -m<mode> If a directory needs to be created, set the mode as an octal
14
- --mode=<mode> permission string.
15
-
16
- -v --version Print the mkdirp version number
17
-
18
- -h --help Print this helpful banner
19
-
20
- -p --print Print the first directories created for each path provided
21
-
22
- --manual Use manual implementation, even if native is available
23
- `
24
-
25
- const dirs = []
26
- const opts = {}
27
- let print = false
28
- let dashdash = false
29
- let manual = false
30
- for (const arg of process.argv.slice(2)) {
31
- if (dashdash)
32
- dirs.push(arg)
33
- else if (arg === '--')
34
- dashdash = true
35
- else if (arg === '--manual')
36
- manual = true
37
- else if (/^-h/.test(arg) || /^--help/.test(arg)) {
38
- console.log(usage())
39
- process.exit(0)
40
- } else if (arg === '-v' || arg === '--version') {
41
- console.log(require('../package.json').version)
42
- process.exit(0)
43
- } else if (arg === '-p' || arg === '--print') {
44
- print = true
45
- } else if (/^-m/.test(arg) || /^--mode=/.test(arg)) {
46
- const mode = parseInt(arg.replace(/^(-m|--mode=)/, ''), 8)
47
- if (isNaN(mode)) {
48
- console.error(`invalid mode argument: ${arg}\nMust be an octal number.`)
49
- process.exit(1)
50
- }
51
- opts.mode = mode
52
- } else
53
- dirs.push(arg)
54
- }
55
-
56
- const mkdirp = require('../')
57
- const impl = manual ? mkdirp.manual : mkdirp
58
- if (dirs.length === 0)
59
- console.error(usage())
60
-
61
- Promise.all(dirs.map(dir => impl(dir, opts)))
62
- .then(made => print ? made.forEach(m => m && console.log(m)) : null)
63
- .catch(er => {
64
- console.error(er.message)
65
- if (er.code)
66
- console.error(' code: ' + er.code)
67
- process.exit(1)
68
- })
@@ -1 +0,0 @@
1
- (function(){var e={237:function(e,t,r){const n=r(10);const s=r(763);const{mkdirpNative:c,mkdirpNativeSync:i}=r(58);const{mkdirpManual:o,mkdirpManualSync:a}=r(559);const{useNative:u,useNativeSync:d}=r(764);const mkdirp=(e,t)=>{e=s(e);t=n(t);return u(t)?c(e,t):o(e,t)};const mkdirpSync=(e,t)=>{e=s(e);t=n(t);return d(t)?i(e,t):a(e,t)};mkdirp.sync=mkdirpSync;mkdirp.native=(e,t)=>c(s(e),n(t));mkdirp.manual=(e,t)=>o(s(e),n(t));mkdirp.nativeSync=(e,t)=>i(s(e),n(t));mkdirp.manualSync=(e,t)=>a(s(e),n(t));e.exports=mkdirp},874:function(e,t,r){const{dirname:n}=r(928);const findMade=(e,t,r=undefined)=>{if(r===t)return Promise.resolve();return e.statAsync(t).then((e=>e.isDirectory()?r:undefined),(r=>r.code==="ENOENT"?findMade(e,n(t),t):undefined))};const findMadeSync=(e,t,r=undefined)=>{if(r===t)return undefined;try{return e.statSync(t).isDirectory()?r:undefined}catch(r){return r.code==="ENOENT"?findMadeSync(e,n(t),t):undefined}};e.exports={findMade:findMade,findMadeSync:findMadeSync}},559:function(e,t,r){const{dirname:n}=r(928);const mkdirpManual=(e,t,r)=>{t.recursive=false;const s=n(e);if(s===e){return t.mkdirAsync(e,t).catch((e=>{if(e.code!=="EISDIR")throw e}))}return t.mkdirAsync(e,t).then((()=>r||e),(n=>{if(n.code==="ENOENT")return mkdirpManual(s,t).then((r=>mkdirpManual(e,t,r)));if(n.code!=="EEXIST"&&n.code!=="EROFS")throw n;return t.statAsync(e).then((e=>{if(e.isDirectory())return r;else throw n}),(()=>{throw n}))}))};const mkdirpManualSync=(e,t,r)=>{const s=n(e);t.recursive=false;if(s===e){try{return t.mkdirSync(e,t)}catch(e){if(e.code!=="EISDIR")throw e;else return}}try{t.mkdirSync(e,t);return r||e}catch(n){if(n.code==="ENOENT")return mkdirpManualSync(e,t,mkdirpManualSync(s,t,r));if(n.code!=="EEXIST"&&n.code!=="EROFS")throw n;try{if(!t.statSync(e).isDirectory())throw n}catch(e){throw n}}};e.exports={mkdirpManual:mkdirpManual,mkdirpManualSync:mkdirpManualSync}},58:function(e,t,r){const{dirname:n}=r(928);const{findMade:s,findMadeSync:c}=r(874);const{mkdirpManual:i,mkdirpManualSync:o}=r(559);const mkdirpNative=(e,t)=>{t.recursive=true;const r=n(e);if(r===e)return t.mkdirAsync(e,t);return s(t,e).then((r=>t.mkdirAsync(e,t).then((()=>r)).catch((r=>{if(r.code==="ENOENT")return i(e,t);else throw r}))))};const mkdirpNativeSync=(e,t)=>{t.recursive=true;const r=n(e);if(r===e)return t.mkdirSync(e,t);const s=c(t,e);try{t.mkdirSync(e,t);return s}catch(r){if(r.code==="ENOENT")return o(e,t);else throw r}};e.exports={mkdirpNative:mkdirpNative,mkdirpNativeSync:mkdirpNativeSync}},10:function(e,t,r){const{promisify:n}=r(23);const s=r(896);const optsArg=e=>{if(!e)e={mode:511,fs:s};else if(typeof e==="object")e={mode:511,fs:s,...e};else if(typeof e==="number")e={mode:e,fs:s};else if(typeof e==="string")e={mode:parseInt(e,8),fs:s};else throw new TypeError("invalid options argument");e.mkdir=e.mkdir||e.fs.mkdir||s.mkdir;e.mkdirAsync=n(e.mkdir);e.stat=e.stat||e.fs.stat||s.stat;e.statAsync=n(e.stat);e.statSync=e.statSync||e.fs.statSync||s.statSync;e.mkdirSync=e.mkdirSync||e.fs.mkdirSync||s.mkdirSync;return e};e.exports=optsArg},763:function(e,t,r){const n=process.env.__TESTING_MKDIRP_PLATFORM__||process.platform;const{resolve:s,parse:c}=r(928);const pathArg=e=>{if(/\0/.test(e)){throw Object.assign(new TypeError("path must be a string without null bytes"),{path:e,code:"ERR_INVALID_ARG_VALUE"})}e=s(e);if(n==="win32"){const t=/[*|"<>?:]/;const{root:r}=c(e);if(t.test(e.substr(r.length))){throw Object.assign(new Error("Illegal characters in path."),{path:e,code:"EINVAL"})}}return e};e.exports=pathArg},764:function(e,t,r){const n=r(896);const s=process.env.__TESTING_MKDIRP_NODE_VERSION__||process.version;const c=s.replace(/^v/,"").split(".");const i=+c[0]>10||+c[0]===10&&+c[1]>=12;const o=!i?()=>false:e=>e.mkdir===n.mkdir;const a=!i?()=>false:e=>e.mkdirSync===n.mkdirSync;e.exports={useNative:o,useNativeSync:a}},896:function(e){"use strict";e.exports=require("fs")},928:function(e){"use strict";e.exports=require("path")},23:function(e){"use strict";e.exports=require("util")}};var t={};function __nccwpck_require__(r){var n=t[r];if(n!==undefined){return n.exports}var s=t[r]={exports:{}};var c=true;try{e[r](s,s.exports,__nccwpck_require__);c=false}finally{if(c)delete t[r]}return s.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var r=__nccwpck_require__(237);module.exports=r})();
@@ -1,29 +0,0 @@
1
- const {dirname} = require('path')
2
-
3
- const findMade = (opts, parent, path = undefined) => {
4
- // we never want the 'made' return value to be a root directory
5
- if (path === parent)
6
- return Promise.resolve()
7
-
8
- return opts.statAsync(parent).then(
9
- st => st.isDirectory() ? path : undefined, // will fail later
10
- er => er.code === 'ENOENT'
11
- ? findMade(opts, dirname(parent), parent)
12
- : undefined
13
- )
14
- }
15
-
16
- const findMadeSync = (opts, parent, path = undefined) => {
17
- if (path === parent)
18
- return undefined
19
-
20
- try {
21
- return opts.statSync(parent).isDirectory() ? path : undefined
22
- } catch (er) {
23
- return er.code === 'ENOENT'
24
- ? findMadeSync(opts, dirname(parent), parent)
25
- : undefined
26
- }
27
- }
28
-
29
- module.exports = {findMade, findMadeSync}
@@ -1,64 +0,0 @@
1
- const {dirname} = require('path')
2
-
3
- const mkdirpManual = (path, opts, made) => {
4
- opts.recursive = false
5
- const parent = dirname(path)
6
- if (parent === path) {
7
- return opts.mkdirAsync(path, opts).catch(er => {
8
- // swallowed by recursive implementation on posix systems
9
- // any other error is a failure
10
- if (er.code !== 'EISDIR')
11
- throw er
12
- })
13
- }
14
-
15
- return opts.mkdirAsync(path, opts).then(() => made || path, er => {
16
- if (er.code === 'ENOENT')
17
- return mkdirpManual(parent, opts)
18
- .then(made => mkdirpManual(path, opts, made))
19
- if (er.code !== 'EEXIST' && er.code !== 'EROFS')
20
- throw er
21
- return opts.statAsync(path).then(st => {
22
- if (st.isDirectory())
23
- return made
24
- else
25
- throw er
26
- }, () => { throw er })
27
- })
28
- }
29
-
30
- const mkdirpManualSync = (path, opts, made) => {
31
- const parent = dirname(path)
32
- opts.recursive = false
33
-
34
- if (parent === path) {
35
- try {
36
- return opts.mkdirSync(path, opts)
37
- } catch (er) {
38
- // swallowed by recursive implementation on posix systems
39
- // any other error is a failure
40
- if (er.code !== 'EISDIR')
41
- throw er
42
- else
43
- return
44
- }
45
- }
46
-
47
- try {
48
- opts.mkdirSync(path, opts)
49
- return made || path
50
- } catch (er) {
51
- if (er.code === 'ENOENT')
52
- return mkdirpManualSync(path, opts, mkdirpManualSync(parent, opts, made))
53
- if (er.code !== 'EEXIST' && er.code !== 'EROFS')
54
- throw er
55
- try {
56
- if (!opts.statSync(path).isDirectory())
57
- throw er
58
- } catch (_) {
59
- throw er
60
- }
61
- }
62
- }
63
-
64
- module.exports = {mkdirpManual, mkdirpManualSync}
@@ -1,39 +0,0 @@
1
- const {dirname} = require('path')
2
- const {findMade, findMadeSync} = require('./find-made.js')
3
- const {mkdirpManual, mkdirpManualSync} = require('./mkdirp-manual.js')
4
-
5
- const mkdirpNative = (path, opts) => {
6
- opts.recursive = true
7
- const parent = dirname(path)
8
- if (parent === path)
9
- return opts.mkdirAsync(path, opts)
10
-
11
- return findMade(opts, path).then(made =>
12
- opts.mkdirAsync(path, opts).then(() => made)
13
- .catch(er => {
14
- if (er.code === 'ENOENT')
15
- return mkdirpManual(path, opts)
16
- else
17
- throw er
18
- }))
19
- }
20
-
21
- const mkdirpNativeSync = (path, opts) => {
22
- opts.recursive = true
23
- const parent = dirname(path)
24
- if (parent === path)
25
- return opts.mkdirSync(path, opts)
26
-
27
- const made = findMadeSync(opts, path)
28
- try {
29
- opts.mkdirSync(path, opts)
30
- return made
31
- } catch (er) {
32
- if (er.code === 'ENOENT')
33
- return mkdirpManualSync(path, opts)
34
- else
35
- throw er
36
- }
37
- }
38
-
39
- module.exports = {mkdirpNative, mkdirpNativeSync}
@@ -1,23 +0,0 @@
1
- const { promisify } = require('util')
2
- const fs = require('fs')
3
- const optsArg = opts => {
4
- if (!opts)
5
- opts = { mode: 0o777, fs }
6
- else if (typeof opts === 'object')
7
- opts = { mode: 0o777, fs, ...opts }
8
- else if (typeof opts === 'number')
9
- opts = { mode: opts, fs }
10
- else if (typeof opts === 'string')
11
- opts = { mode: parseInt(opts, 8), fs }
12
- else
13
- throw new TypeError('invalid options argument')
14
-
15
- opts.mkdir = opts.mkdir || opts.fs.mkdir || fs.mkdir
16
- opts.mkdirAsync = promisify(opts.mkdir)
17
- opts.stat = opts.stat || opts.fs.stat || fs.stat
18
- opts.statAsync = promisify(opts.stat)
19
- opts.statSync = opts.statSync || opts.fs.statSync || fs.statSync
20
- opts.mkdirSync = opts.mkdirSync || opts.fs.mkdirSync || fs.mkdirSync
21
- return opts
22
- }
23
- module.exports = optsArg
@@ -1,29 +0,0 @@
1
- const platform = process.env.__TESTING_MKDIRP_PLATFORM__ || process.platform
2
- const { resolve, parse } = require('path')
3
- const pathArg = path => {
4
- if (/\0/.test(path)) {
5
- // simulate same failure that node raises
6
- throw Object.assign(
7
- new TypeError('path must be a string without null bytes'),
8
- {
9
- path,
10
- code: 'ERR_INVALID_ARG_VALUE',
11
- }
12
- )
13
- }
14
-
15
- path = resolve(path)
16
- if (platform === 'win32') {
17
- const badWinChars = /[*|"<>?:]/
18
- const {root} = parse(path)
19
- if (badWinChars.test(path.substr(root.length))) {
20
- throw Object.assign(new Error('Illegal characters in path.'), {
21
- path,
22
- code: 'EINVAL',
23
- })
24
- }
25
- }
26
-
27
- return path
28
- }
29
- module.exports = pathArg
@@ -1,10 +0,0 @@
1
- const fs = require('fs')
2
-
3
- const version = process.env.__TESTING_MKDIRP_NODE_VERSION__ || process.version
4
- const versArr = version.replace(/^v/, '').split('.')
5
- const hasNative = +versArr[0] > 10 || +versArr[0] === 10 && +versArr[1] >= 12
6
-
7
- const useNative = !hasNative ? () => false : opts => opts.mkdir === fs.mkdir
8
- const useNativeSync = !hasNative ? () => false : opts => opts.mkdirSync === fs.mkdirSync
9
-
10
- module.exports = {useNative, useNativeSync}
@@ -1 +0,0 @@
1
- {"name":"mkdirp","description":"Recursively mkdir, like `mkdir -p`","version":"1.0.4","main":"index.js","keywords":["mkdir","directory","make dir","make","dir","recursive","native"],"repository":{"type":"git","url":"https://github.com/isaacs/node-mkdirp.git"},"scripts":{"test":"tap","snap":"tap","preversion":"npm test","postversion":"npm publish","postpublish":"git push origin --follow-tags"},"tap":{"check-coverage":true,"coverage-map":"map.js"},"devDependencies":{"require-inject":"^1.4.4","tap":"^14.10.7"},"bin":"bin/cmd.js","license":"MIT","engines":{"node":">=10"},"files":["bin","lib","index.js"],"_lastModified":"2025-08-03T23:04:07.946Z"}
@@ -1,266 +0,0 @@
1
- # mkdirp
2
-
3
- Like `mkdir -p`, but in Node.js!
4
-
5
- Now with a modern API and no\* bugs!
6
-
7
- <small>\* may contain some bugs</small>
8
-
9
- # example
10
-
11
- ## pow.js
12
-
13
- ```js
14
- const mkdirp = require('mkdirp')
15
-
16
- // return value is a Promise resolving to the first directory created
17
- mkdirp('/tmp/foo/bar/baz').then(made =>
18
- console.log(`made directories, starting with ${made}`))
19
- ```
20
-
21
- Output (where `/tmp/foo` already exists)
22
-
23
- ```
24
- made directories, starting with /tmp/foo/bar
25
- ```
26
-
27
- Or, if you don't have time to wait around for promises:
28
-
29
- ```js
30
- const mkdirp = require('mkdirp')
31
-
32
- // return value is the first directory created
33
- const made = mkdirp.sync('/tmp/foo/bar/baz')
34
- console.log(`made directories, starting with ${made}`)
35
- ```
36
-
37
- And now /tmp/foo/bar/baz exists, huzzah!
38
-
39
- # methods
40
-
41
- ```js
42
- const mkdirp = require('mkdirp')
43
- ```
44
-
45
- ## mkdirp(dir, [opts]) -> Promise<String | undefined>
46
-
47
- Create a new directory and any necessary subdirectories at `dir` with octal
48
- permission string `opts.mode`. If `opts` is a string or number, it will be
49
- treated as the `opts.mode`.
50
-
51
- If `opts.mode` isn't specified, it defaults to `0o777 &
52
- (~process.umask())`.
53
-
54
- Promise resolves to first directory `made` that had to be created, or
55
- `undefined` if everything already exists. Promise rejects if any errors
56
- are encountered. Note that, in the case of promise rejection, some
57
- directories _may_ have been created, as recursive directory creation is not
58
- an atomic operation.
59
-
60
- You can optionally pass in an alternate `fs` implementation by passing in
61
- `opts.fs`. Your implementation should have `opts.fs.mkdir(path, opts, cb)`
62
- and `opts.fs.stat(path, cb)`.
63
-
64
- You can also override just one or the other of `mkdir` and `stat` by
65
- passing in `opts.stat` or `opts.mkdir`, or providing an `fs` option that
66
- only overrides one of these.
67
-
68
- ## mkdirp.sync(dir, opts) -> String|null
69
-
70
- Synchronously create a new directory and any necessary subdirectories at
71
- `dir` with octal permission string `opts.mode`. If `opts` is a string or
72
- number, it will be treated as the `opts.mode`.
73
-
74
- If `opts.mode` isn't specified, it defaults to `0o777 &
75
- (~process.umask())`.
76
-
77
- Returns the first directory that had to be created, or undefined if
78
- everything already exists.
79
-
80
- You can optionally pass in an alternate `fs` implementation by passing in
81
- `opts.fs`. Your implementation should have `opts.fs.mkdirSync(path, mode)`
82
- and `opts.fs.statSync(path)`.
83
-
84
- You can also override just one or the other of `mkdirSync` and `statSync`
85
- by passing in `opts.statSync` or `opts.mkdirSync`, or providing an `fs`
86
- option that only overrides one of these.
87
-
88
- ## mkdirp.manual, mkdirp.manualSync
89
-
90
- Use the manual implementation (not the native one). This is the default
91
- when the native implementation is not available or the stat/mkdir
92
- implementation is overridden.
93
-
94
- ## mkdirp.native, mkdirp.nativeSync
95
-
96
- Use the native implementation (not the manual one). This is the default
97
- when the native implementation is available and stat/mkdir are not
98
- overridden.
99
-
100
- # implementation
101
-
102
- On Node.js v10.12.0 and above, use the native `fs.mkdir(p,
103
- {recursive:true})` option, unless `fs.mkdir`/`fs.mkdirSync` has been
104
- overridden by an option.
105
-
106
- ## native implementation
107
-
108
- - If the path is a root directory, then pass it to the underlying
109
- implementation and return the result/error. (In this case, it'll either
110
- succeed or fail, but we aren't actually creating any dirs.)
111
- - Walk up the path statting each directory, to find the first path that
112
- will be created, `made`.
113
- - Call `fs.mkdir(path, { recursive: true })` (or `fs.mkdirSync`)
114
- - If error, raise it to the caller.
115
- - Return `made`.
116
-
117
- ## manual implementation
118
-
119
- - Call underlying `fs.mkdir` implementation, with `recursive: false`
120
- - If error:
121
- - If path is a root directory, raise to the caller and do not handle it
122
- - If ENOENT, mkdirp parent dir, store result as `made`
123
- - stat(path)
124
- - If error, raise original `mkdir` error
125
- - If directory, return `made`
126
- - Else, raise original `mkdir` error
127
- - else
128
- - return `undefined` if a root dir, or `made` if set, or `path`
129
-
130
- ## windows vs unix caveat
131
-
132
- On Windows file systems, attempts to create a root directory (ie, a drive
133
- letter or root UNC path) will fail. If the root directory exists, then it
134
- will fail with `EPERM`. If the root directory does not exist, then it will
135
- fail with `ENOENT`.
136
-
137
- On posix file systems, attempts to create a root directory (in recursive
138
- mode) will succeed silently, as it is treated like just another directory
139
- that already exists. (In non-recursive mode, of course, it fails with
140
- `EEXIST`.)
141
-
142
- In order to preserve this system-specific behavior (and because it's not as
143
- if we can create the parent of a root directory anyway), attempts to create
144
- a root directory are passed directly to the `fs` implementation, and any
145
- errors encountered are not handled.
146
-
147
- ## native error caveat
148
-
149
- The native implementation (as of at least Node.js v13.4.0) does not provide
150
- appropriate errors in some cases (see
151
- [nodejs/node#31481](https://github.com/nodejs/node/issues/31481) and
152
- [nodejs/node#28015](https://github.com/nodejs/node/issues/28015)).
153
-
154
- In order to work around this issue, the native implementation will fall
155
- back to the manual implementation if an `ENOENT` error is encountered.
156
-
157
- # choosing a recursive mkdir implementation
158
-
159
- There are a few to choose from! Use the one that suits your needs best :D
160
-
161
- ## use `fs.mkdir(path, {recursive: true}, cb)` if:
162
-
163
- - You wish to optimize performance even at the expense of other factors.
164
- - You don't need to know the first dir created.
165
- - You are ok with getting `ENOENT` as the error when some other problem is
166
- the actual cause.
167
- - You can limit your platforms to Node.js v10.12 and above.
168
- - You're ok with using callbacks instead of promises.
169
- - You don't need/want a CLI.
170
- - You don't need to override the `fs` methods in use.
171
-
172
- ## use this module (mkdirp 1.x) if:
173
-
174
- - You need to know the first directory that was created.
175
- - You wish to use the native implementation if available, but fall back
176
- when it's not.
177
- - You prefer promise-returning APIs to callback-taking APIs.
178
- - You want more useful error messages than the native recursive mkdir
179
- provides (at least as of Node.js v13.4), and are ok with re-trying on
180
- `ENOENT` to achieve this.
181
- - You need (or at least, are ok with) a CLI.
182
- - You need to override the `fs` methods in use.
183
-
184
- ## use [`make-dir`](http://npm.im/make-dir) if:
185
-
186
- - You do not need to know the first dir created (and wish to save a few
187
- `stat` calls when using the native implementation for this reason).
188
- - You wish to use the native implementation if available, but fall back
189
- when it's not.
190
- - You prefer promise-returning APIs to callback-taking APIs.
191
- - You are ok with occasionally getting `ENOENT` errors for failures that
192
- are actually related to something other than a missing file system entry.
193
- - You don't need/want a CLI.
194
- - You need to override the `fs` methods in use.
195
-
196
- ## use mkdirp 0.x if:
197
-
198
- - You need to know the first directory that was created.
199
- - You need (or at least, are ok with) a CLI.
200
- - You need to override the `fs` methods in use.
201
- - You're ok with using callbacks instead of promises.
202
- - You are not running on Windows, where the root-level ENOENT errors can
203
- lead to infinite regress.
204
- - You think vinyl just sounds warmer and richer for some weird reason.
205
- - You are supporting truly ancient Node.js versions, before even the advent
206
- of a `Promise` language primitive. (Please don't. You deserve better.)
207
-
208
- # cli
209
-
210
- This package also ships with a `mkdirp` command.
211
-
212
- ```
213
- $ mkdirp -h
214
-
215
- usage: mkdirp [DIR1,DIR2..] {OPTIONS}
216
-
217
- Create each supplied directory including any necessary parent directories
218
- that don't yet exist.
219
-
220
- If the directory already exists, do nothing.
221
-
222
- OPTIONS are:
223
-
224
- -m<mode> If a directory needs to be created, set the mode as an octal
225
- --mode=<mode> permission string.
226
-
227
- -v --version Print the mkdirp version number
228
-
229
- -h --help Print this helpful banner
230
-
231
- -p --print Print the first directories created for each path provided
232
-
233
- --manual Use manual implementation, even if native is available
234
- ```
235
-
236
- # install
237
-
238
- With [npm](http://npmjs.org) do:
239
-
240
- ```
241
- npm install mkdirp
242
- ```
243
-
244
- to get the library locally, or
245
-
246
- ```
247
- npm install -g mkdirp
248
- ```
249
-
250
- to get the command everywhere, or
251
-
252
- ```
253
- npx mkdirp ...
254
- ```
255
-
256
- to run the command without installing it globally.
257
-
258
- # platform support
259
-
260
- This module works on node v8, but only v10 and above are officially
261
- supported, as Node v8 reached its LTS end of life 2020-01-01, which is in
262
- the past, as of this writing.
263
-
264
- # license
265
-
266
- MIT