soda-nodejs 0.6.6 → 0.7.1
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/dist/index.cjs +123 -0
- package/dist/index.js +8 -0
- package/dist/utils/compress.cjs +54 -0
- package/dist/utils/compress.js +20 -0
- package/dist/utils/copy.cjs +70 -0
- package/dist/utils/copy.js +36 -0
- package/dist/utils/execAsync.cjs +61 -0
- package/dist/{esm/utils → utils}/execAsync.d.ts +0 -4
- package/dist/utils/execAsync.js +17 -0
- package/dist/utils/saveFile.cjs +43 -0
- package/dist/utils/saveFile.js +9 -0
- package/dist/utils/saveResponse.cjs +41 -0
- package/dist/utils/saveResponse.js +7 -0
- package/dist/utils/spawnAsync.cjs +78 -0
- package/dist/{cjs/utils → utils}/spawnAsync.d.ts +0 -2
- package/dist/utils/spawnAsync.js +38 -0
- package/dist/utils/unzip.cjs +53 -0
- package/dist/utils/unzip.js +9 -0
- package/dist/utils/zip.cjs +56 -0
- package/dist/utils/zip.js +12 -0
- package/package.json +27 -15
- package/tsconfig.json +15 -0
- package/dist/cjs/index.js +0 -38
- package/dist/cjs/index.js.map +0 -7
- package/dist/cjs/utils/compress.js +0 -53
- package/dist/cjs/utils/compress.js.map +0 -7
- package/dist/cjs/utils/copy.js +0 -58
- package/dist/cjs/utils/copy.js.map +0 -7
- package/dist/cjs/utils/execAsync.d.ts +0 -36
- package/dist/cjs/utils/execAsync.js +0 -57
- package/dist/cjs/utils/execAsync.js.map +0 -7
- package/dist/cjs/utils/saveFile.js +0 -37
- package/dist/cjs/utils/saveFile.js.map +0 -7
- package/dist/cjs/utils/saveResponse.js +0 -37
- package/dist/cjs/utils/saveResponse.js.map +0 -7
- package/dist/cjs/utils/spawnAsync.js +0 -69
- package/dist/cjs/utils/spawnAsync.js.map +0 -7
- package/dist/cjs/utils/unzip.js +0 -45
- package/dist/cjs/utils/unzip.js.map +0 -7
- package/dist/cjs/utils/zip.js +0 -52
- package/dist/cjs/utils/zip.js.map +0 -7
- package/dist/esm/index.d.ts +0 -8
- package/dist/esm/index.js +0 -9
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/utils/compress.d.ts +0 -11
- package/dist/esm/utils/compress.js +0 -30
- package/dist/esm/utils/compress.js.map +0 -1
- package/dist/esm/utils/copy.d.ts +0 -9
- package/dist/esm/utils/copy.js +0 -44
- package/dist/esm/utils/copy.js.map +0 -1
- package/dist/esm/utils/execAsync.js +0 -21
- package/dist/esm/utils/execAsync.js.map +0 -1
- package/dist/esm/utils/saveFile.d.ts +0 -10
- package/dist/esm/utils/saveFile.js +0 -15
- package/dist/esm/utils/saveFile.js.map +0 -1
- package/dist/esm/utils/saveResponse.d.ts +0 -6
- package/dist/esm/utils/saveResponse.js +0 -13
- package/dist/esm/utils/saveResponse.js.map +0 -1
- package/dist/esm/utils/spawnAsync.d.ts +0 -38
- package/dist/esm/utils/spawnAsync.js +0 -52
- package/dist/esm/utils/spawnAsync.js.map +0 -1
- package/dist/esm/utils/unzip.d.ts +0 -26
- package/dist/esm/utils/unzip.js +0 -24
- package/dist/esm/utils/unzip.js.map +0 -1
- package/dist/esm/utils/zip.d.ts +0 -38
- package/dist/esm/utils/zip.js +0 -30
- package/dist/esm/utils/zip.js.map +0 -1
- /package/dist/{cjs/index.d.ts → index.d.ts} +0 -0
- /package/dist/{cjs/utils → utils}/compress.d.ts +0 -0
- /package/dist/{cjs/utils → utils}/copy.d.ts +0 -0
- /package/dist/{cjs/utils → utils}/saveFile.d.ts +0 -0
- /package/dist/{cjs/utils → utils}/saveResponse.d.ts +0 -0
- /package/dist/{cjs/utils → utils}/unzip.d.ts +0 -0
- /package/dist/{cjs/utils → utils}/zip.d.ts +0 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.n = (module)=>{
|
|
5
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
+
__webpack_require__.d(getter, {
|
|
7
|
+
a: getter
|
|
8
|
+
});
|
|
9
|
+
return getter;
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
14
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: definition[key]
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
})();
|
|
20
|
+
(()=>{
|
|
21
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
22
|
+
})();
|
|
23
|
+
(()=>{
|
|
24
|
+
__webpack_require__.r = (exports1)=>{
|
|
25
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
26
|
+
value: 'Module'
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
29
|
+
value: true
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
})();
|
|
33
|
+
var __webpack_exports__ = {};
|
|
34
|
+
__webpack_require__.r(__webpack_exports__);
|
|
35
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
36
|
+
unzip: ()=>unzip
|
|
37
|
+
});
|
|
38
|
+
const external_which_namespaceObject = require("which");
|
|
39
|
+
var external_which_default = /*#__PURE__*/ __webpack_require__.n(external_which_namespaceObject);
|
|
40
|
+
const external_execAsync_cjs_namespaceObject = require("./execAsync.cjs");
|
|
41
|
+
async function unzip({ input, output, cwd }) {
|
|
42
|
+
await external_which_default()("7z");
|
|
43
|
+
return await (0, external_execAsync_cjs_namespaceObject.execAsync)(`7z x ${input} -o${output}`, {
|
|
44
|
+
cwd
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
exports.unzip = __webpack_exports__.unzip;
|
|
48
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
49
|
+
"unzip"
|
|
50
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
51
|
+
Object.defineProperty(exports, '__esModule', {
|
|
52
|
+
value: true
|
|
53
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE_which__ from "which";
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE__execAsync_js_bec93fa3__ from "./execAsync.js";
|
|
3
|
+
async function unzip({ input, output, cwd }) {
|
|
4
|
+
await (0, __WEBPACK_EXTERNAL_MODULE_which__["default"])("7z");
|
|
5
|
+
return await (0, __WEBPACK_EXTERNAL_MODULE__execAsync_js_bec93fa3__.execAsync)(`7z x ${input} -o${output}`, {
|
|
6
|
+
cwd
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
export { unzip };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.n = (module)=>{
|
|
5
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
+
__webpack_require__.d(getter, {
|
|
7
|
+
a: getter
|
|
8
|
+
});
|
|
9
|
+
return getter;
|
|
10
|
+
};
|
|
11
|
+
})();
|
|
12
|
+
(()=>{
|
|
13
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
14
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: definition[key]
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
})();
|
|
20
|
+
(()=>{
|
|
21
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
22
|
+
})();
|
|
23
|
+
(()=>{
|
|
24
|
+
__webpack_require__.r = (exports1)=>{
|
|
25
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
26
|
+
value: 'Module'
|
|
27
|
+
});
|
|
28
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
29
|
+
value: true
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
})();
|
|
33
|
+
var __webpack_exports__ = {};
|
|
34
|
+
__webpack_require__.r(__webpack_exports__);
|
|
35
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
36
|
+
zip: ()=>zip
|
|
37
|
+
});
|
|
38
|
+
const external_os_namespaceObject = require("os");
|
|
39
|
+
const external_which_namespaceObject = require("which");
|
|
40
|
+
var external_which_default = /*#__PURE__*/ __webpack_require__.n(external_which_namespaceObject);
|
|
41
|
+
const external_execAsync_cjs_namespaceObject = require("./execAsync.cjs");
|
|
42
|
+
async function zip({ input, output, thread = "auto", level, password, cwd }) {
|
|
43
|
+
await external_which_default()("7z");
|
|
44
|
+
input = Array.isArray(input) ? input.join(" ") : input;
|
|
45
|
+
if ("max" === thread) thread = (0, external_os_namespaceObject.cpus)().length;
|
|
46
|
+
return await (0, external_execAsync_cjs_namespaceObject.execAsync)(`7z a ${output} ${input} -mmt=${"auto" === thread ? "on" : thread}${"number" == typeof level ? ` -mx=${level}` : ""}${password ? ` -p${password}` : ""}`, {
|
|
47
|
+
cwd
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
exports.zip = __webpack_exports__.zip;
|
|
51
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
52
|
+
"zip"
|
|
53
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
54
|
+
Object.defineProperty(exports, '__esModule', {
|
|
55
|
+
value: true
|
|
56
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as __WEBPACK_EXTERNAL_MODULE_os__ from "os";
|
|
2
|
+
import * as __WEBPACK_EXTERNAL_MODULE_which__ from "which";
|
|
3
|
+
import * as __WEBPACK_EXTERNAL_MODULE__execAsync_js_bec93fa3__ from "./execAsync.js";
|
|
4
|
+
async function zip({ input, output, thread = "auto", level, password, cwd }) {
|
|
5
|
+
await (0, __WEBPACK_EXTERNAL_MODULE_which__["default"])("7z");
|
|
6
|
+
input = Array.isArray(input) ? input.join(" ") : input;
|
|
7
|
+
if ("max" === thread) thread = (0, __WEBPACK_EXTERNAL_MODULE_os__.cpus)().length;
|
|
8
|
+
return await (0, __WEBPACK_EXTERNAL_MODULE__execAsync_js_bec93fa3__.execAsync)(`7z a ${output} ${input} -mmt=${"auto" === thread ? "on" : thread}${"number" == typeof level ? ` -mx=${level}` : ""}${password ? ` -p${password}` : ""}`, {
|
|
9
|
+
cwd
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
export { zip };
|
package/package.json
CHANGED
|
@@ -1,18 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "soda-nodejs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"description": "",
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
|
|
5
|
+
"type": "module",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"import": "./dist/index.js",
|
|
10
|
+
"require": "./dist/index.cjs"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"main": "./dist/index.cjs",
|
|
14
|
+
"module": "./dist/index.js",
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
8
16
|
"sideEffects": false,
|
|
9
17
|
"keywords": [],
|
|
10
|
-
"authors": [
|
|
18
|
+
"authors": [
|
|
19
|
+
"lurongv@qq.com"
|
|
20
|
+
],
|
|
11
21
|
"license": "MIT",
|
|
12
22
|
"files": [
|
|
13
23
|
"compiled",
|
|
14
24
|
"dist",
|
|
15
|
-
"src"
|
|
25
|
+
"src",
|
|
26
|
+
"tsconfig.json"
|
|
16
27
|
],
|
|
17
28
|
"publishConfig": {
|
|
18
29
|
"access": "public",
|
|
@@ -23,20 +34,21 @@
|
|
|
23
34
|
"url": "git+https://github.com/1adybug/deepsea.git"
|
|
24
35
|
},
|
|
25
36
|
"homepage": "https://github.com/1adybug/deepsea/tree/main/packages/soda-nodejs",
|
|
26
|
-
"devDependencies": {
|
|
27
|
-
"@types/node": "^20.17.24",
|
|
28
|
-
"@types/which": "^3.0.4",
|
|
29
|
-
"typescript": "^5.8.2"
|
|
30
|
-
},
|
|
31
37
|
"dependencies": {
|
|
32
38
|
"iconv-lite": "^0.6.3",
|
|
33
39
|
"tar": "^7.4.3",
|
|
34
|
-
"which": "^
|
|
40
|
+
"which": "^5.0.0"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@types/node": "^22.14.0",
|
|
44
|
+
"@types/which": "^3.0.4",
|
|
45
|
+
"typescript": "^5.8.3"
|
|
35
46
|
},
|
|
47
|
+
"peerDependencies": {},
|
|
36
48
|
"scripts": {
|
|
37
|
-
"dev": "
|
|
38
|
-
"build": "
|
|
49
|
+
"dev": "rslib build --watch",
|
|
50
|
+
"build": "rslib build",
|
|
39
51
|
"prebuild": "tsx scripts/export.ts",
|
|
40
|
-
"
|
|
52
|
+
"lint": "prettier --write ."
|
|
41
53
|
}
|
|
42
54
|
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"baseUrl": ".",
|
|
4
|
+
"strict": true,
|
|
5
|
+
"declaration": true,
|
|
6
|
+
"skipLibCheck": true,
|
|
7
|
+
"target": "ESNext",
|
|
8
|
+
"module": "ESNext",
|
|
9
|
+
"moduleResolution": "Bundler",
|
|
10
|
+
"paths": {
|
|
11
|
+
"@/*": ["./src/*"]
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"include": ["src"]
|
|
15
|
+
}
|
package/dist/cjs/index.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __copyProps = (to, from, except, desc) => {
|
|
6
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
7
|
-
for (let key of __getOwnPropNames(from))
|
|
8
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
9
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
10
|
-
}
|
|
11
|
-
return to;
|
|
12
|
-
};
|
|
13
|
-
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
14
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
-
|
|
16
|
-
// src/index.ts
|
|
17
|
-
var src_exports = {};
|
|
18
|
-
module.exports = __toCommonJS(src_exports);
|
|
19
|
-
__reExport(src_exports, require("./utils/compress"), module.exports);
|
|
20
|
-
__reExport(src_exports, require("./utils/copy"), module.exports);
|
|
21
|
-
__reExport(src_exports, require("./utils/execAsync"), module.exports);
|
|
22
|
-
__reExport(src_exports, require("./utils/saveFile"), module.exports);
|
|
23
|
-
__reExport(src_exports, require("./utils/saveResponse"), module.exports);
|
|
24
|
-
__reExport(src_exports, require("./utils/spawnAsync"), module.exports);
|
|
25
|
-
__reExport(src_exports, require("./utils/unzip"), module.exports);
|
|
26
|
-
__reExport(src_exports, require("./utils/zip"), module.exports);
|
|
27
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
28
|
-
0 && (module.exports = {
|
|
29
|
-
...require("./utils/compress"),
|
|
30
|
-
...require("./utils/copy"),
|
|
31
|
-
...require("./utils/execAsync"),
|
|
32
|
-
...require("./utils/saveFile"),
|
|
33
|
-
...require("./utils/saveResponse"),
|
|
34
|
-
...require("./utils/spawnAsync"),
|
|
35
|
-
...require("./utils/unzip"),
|
|
36
|
-
...require("./utils/zip")
|
|
37
|
-
});
|
|
38
|
-
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/index.ts"],
|
|
4
|
-
"sourcesContent": ["export * from \"@/utils/compress\"\nexport * from \"@/utils/copy\"\nexport * from \"@/utils/execAsync\"\nexport * from \"@/utils/saveFile\"\nexport * from \"@/utils/saveResponse\"\nexport * from \"@/utils/spawnAsync\"\nexport * from \"@/utils/unzip\"\nexport * from \"@/utils/zip\"\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,wBAAc,6BAAd;AACA,wBAAc,yBADd;AAEA,wBAAc,8BAFd;AAGA,wBAAc,6BAHd;AAIA,wBAAc,iCAJd;AAKA,wBAAc,+BALd;AAMA,wBAAc,0BANd;AAOA,wBAAc,wBAPd;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
|
|
19
|
-
// src/utils/compress.ts
|
|
20
|
-
var compress_exports = {};
|
|
21
|
-
__export(compress_exports, {
|
|
22
|
-
compress: () => compress
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(compress_exports);
|
|
25
|
-
var import_fs = require("fs");
|
|
26
|
-
var import_path = require("path");
|
|
27
|
-
var import_tar = require("tar");
|
|
28
|
-
async function compress({ input, output }) {
|
|
29
|
-
input = (0, import_path.resolve)(input);
|
|
30
|
-
if (!(0, import_fs.existsSync)(input))
|
|
31
|
-
throw new Error("Source folder does not exist");
|
|
32
|
-
const outputDir = (0, import_path.dirname)(output);
|
|
33
|
-
if (!(0, import_fs.existsSync)(outputDir))
|
|
34
|
-
(0, import_fs.mkdirSync)(outputDir, { recursive: true });
|
|
35
|
-
await (0, import_tar.create)(
|
|
36
|
-
{
|
|
37
|
-
gzip: true,
|
|
38
|
-
// 使用 gzip 压缩
|
|
39
|
-
file: output,
|
|
40
|
-
// 输出文件路径
|
|
41
|
-
cwd: (0, import_path.dirname)(input)
|
|
42
|
-
// 设置工作目录
|
|
43
|
-
},
|
|
44
|
-
[(0, import_path.basename)(input)]
|
|
45
|
-
// 要压缩的文件夹名
|
|
46
|
-
);
|
|
47
|
-
return (0, import_path.resolve)(output);
|
|
48
|
-
}
|
|
49
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
50
|
-
0 && (module.exports = {
|
|
51
|
-
compress
|
|
52
|
-
});
|
|
53
|
-
//# sourceMappingURL=compress.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/utils/compress.ts"],
|
|
4
|
-
"sourcesContent": ["import { existsSync, mkdirSync } from \"fs\"\nimport { basename, dirname, resolve } from \"path\"\nimport { create } from \"tar\"\n\nexport interface CompressionParams {\n /**\n * 需要压缩的文件夹\n */\n input: string\n /**\n * 压缩后的文件路径\n */\n output: string\n}\n\nexport async function compress({ input, output }: CompressionParams) {\n input = resolve(input)\n\n // 确保源路径存在\n if (!existsSync(input)) throw new Error(\"Source folder does not exist\")\n\n // 确保输出目录存在\n const outputDir = dirname(output)\n if (!existsSync(outputDir)) mkdirSync(outputDir, { recursive: true })\n\n // 执行压缩\n await create(\n {\n gzip: true, // 使用 gzip 压缩\n file: output, // 输出文件路径\n cwd: dirname(input), // 设置工作目录\n },\n [basename(input)], // 要压缩的文件夹名\n )\n\n return resolve(output)\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAAsC;AACtC,kBAA2C;AAC3C,iBAAuB;AAavB,eAAsB,SAAS,EAAE,OAAO,OAAO,GAAsB;AACjE,cAAQ,qBAAQ,KAAK;AAGrB,MAAI,KAAC,sBAAW,KAAK;AAAG,UAAM,IAAI,MAAM,8BAA8B;AAGtE,QAAM,gBAAY,qBAAQ,MAAM;AAChC,MAAI,KAAC,sBAAW,SAAS;AAAG,6BAAU,WAAW,EAAE,WAAW,KAAK,CAAC;AAGpE,YAAM;AAAA,IACF;AAAA,MACI,MAAM;AAAA;AAAA,MACN,MAAM;AAAA;AAAA,MACN,SAAK,qBAAQ,KAAK;AAAA;AAAA,IACtB;AAAA,IACA,KAAC,sBAAS,KAAK,CAAC;AAAA;AAAA,EACpB;AAEA,aAAO,qBAAQ,MAAM;AACzB;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
package/dist/cjs/utils/copy.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
|
|
19
|
-
// src/utils/copy.ts
|
|
20
|
-
var copy_exports = {};
|
|
21
|
-
__export(copy_exports, {
|
|
22
|
-
copy: () => copy
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(copy_exports);
|
|
25
|
-
var import_fs = require("fs");
|
|
26
|
-
var import_promises = require("fs/promises");
|
|
27
|
-
var import_path = require("path");
|
|
28
|
-
async function copy({ input, output, mode }) {
|
|
29
|
-
if (Array.isArray(input)) {
|
|
30
|
-
for (const item of input)
|
|
31
|
-
await copy({ input: item, output, mode });
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
if (!(0, import_fs.existsSync)(output))
|
|
35
|
-
await (0, import_promises.mkdir)(output, { recursive: true });
|
|
36
|
-
const status = await (0, import_promises.stat)(input);
|
|
37
|
-
const { base } = (0, import_path.parse)(input);
|
|
38
|
-
if (status.isFile()) {
|
|
39
|
-
await (0, import_promises.copyFile)(input, (0, import_path.join)(output, base), mode);
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
if (status.isDirectory()) {
|
|
43
|
-
await (0, import_promises.mkdir)((0, import_path.join)(output, base), { recursive: true });
|
|
44
|
-
const entries = await (0, import_promises.readdir)(input, { withFileTypes: true });
|
|
45
|
-
for (const entry of entries) {
|
|
46
|
-
await copy({
|
|
47
|
-
input: (0, import_path.join)(input, entry.name),
|
|
48
|
-
output: (0, import_path.join)(output, base),
|
|
49
|
-
mode
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
55
|
-
0 && (module.exports = {
|
|
56
|
-
copy
|
|
57
|
-
});
|
|
58
|
-
//# sourceMappingURL=copy.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/utils/copy.ts"],
|
|
4
|
-
"sourcesContent": ["import { existsSync } from \"fs\"\nimport { copyFile, mkdir, readdir, stat } from \"fs/promises\"\nimport { join, parse } from \"path\"\n\nexport type CopyOptions = {\n /** 源文件夹 */\n input: string | string[]\n /** 存放的文件夹 */\n output: string\n /** 文件权限 */\n mode?: number\n}\n\nexport async function copy({ input, output, mode }: CopyOptions) {\n if (Array.isArray(input)) {\n for (const item of input) await copy({ input: item, output, mode })\n return\n }\n if (!existsSync(output)) await mkdir(output, { recursive: true })\n const status = await stat(input)\n const { base } = parse(input)\n if (status.isFile()) {\n await copyFile(input, join(output, base), mode)\n return\n }\n if (status.isDirectory()) {\n await mkdir(join(output, base), { recursive: true })\n const entries = await readdir(input, { withFileTypes: true })\n for (const entry of entries) {\n await copy({\n input: join(input, entry.name),\n output: join(output, base),\n mode,\n })\n }\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAA2B;AAC3B,sBAA+C;AAC/C,kBAA4B;AAW5B,eAAsB,KAAK,EAAE,OAAO,QAAQ,KAAK,GAAgB;AAC7D,MAAI,MAAM,QAAQ,KAAK,GAAG;AACtB,eAAW,QAAQ;AAAO,YAAM,KAAK,EAAE,OAAO,MAAM,QAAQ,KAAK,CAAC;AAClE;AAAA,EACJ;AACA,MAAI,KAAC,sBAAW,MAAM;AAAG,cAAM,uBAAM,QAAQ,EAAE,WAAW,KAAK,CAAC;AAChE,QAAM,SAAS,UAAM,sBAAK,KAAK;AAC/B,QAAM,EAAE,KAAK,QAAI,mBAAM,KAAK;AAC5B,MAAI,OAAO,OAAO,GAAG;AACjB,cAAM,0BAAS,WAAO,kBAAK,QAAQ,IAAI,GAAG,IAAI;AAC9C;AAAA,EACJ;AACA,MAAI,OAAO,YAAY,GAAG;AACtB,cAAM,2BAAM,kBAAK,QAAQ,IAAI,GAAG,EAAE,WAAW,KAAK,CAAC;AACnD,UAAM,UAAU,UAAM,yBAAQ,OAAO,EAAE,eAAe,KAAK,CAAC;AAC5D,eAAW,SAAS,SAAS;AACzB,YAAM,KAAK;AAAA,QACP,WAAO,kBAAK,OAAO,MAAM,IAAI;AAAA,QAC7B,YAAQ,kBAAK,QAAQ,IAAI;AAAA,QACzB;AAAA,MACJ,CAAC;AAAA,IACL;AAAA,EACJ;AACJ;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
/// <reference types="node" />
|
|
4
|
-
/// <reference types="node" />
|
|
5
|
-
import { ExecOptions } from "child_process";
|
|
6
|
-
import { ObjectEncodingOptions } from "fs";
|
|
7
|
-
import { Options } from "iconv-lite";
|
|
8
|
-
export type IconvDecodeOptions = {
|
|
9
|
-
encoding: string;
|
|
10
|
-
options?: Options;
|
|
11
|
-
};
|
|
12
|
-
export declare function execAsync(command: string): Promise<string>;
|
|
13
|
-
export declare function execAsync(command: string, options: {
|
|
14
|
-
encoding: "buffer" | null;
|
|
15
|
-
} & ExecOptions): Promise<Buffer>;
|
|
16
|
-
export declare function execAsync(command: string, options: {
|
|
17
|
-
encoding: "buffer" | null;
|
|
18
|
-
} & ExecOptions & {
|
|
19
|
-
decode: IconvDecodeOptions;
|
|
20
|
-
}): Promise<string>;
|
|
21
|
-
export declare function execAsync(command: string, options: {
|
|
22
|
-
encoding: BufferEncoding;
|
|
23
|
-
} & ExecOptions): Promise<string>;
|
|
24
|
-
export declare function execAsync(command: string, options: {
|
|
25
|
-
encoding: BufferEncoding;
|
|
26
|
-
} & ExecOptions): Promise<string | Buffer>;
|
|
27
|
-
export declare function execAsync(command: string, options: {
|
|
28
|
-
encoding: BufferEncoding;
|
|
29
|
-
} & ExecOptions & {
|
|
30
|
-
decode: IconvDecodeOptions;
|
|
31
|
-
}): Promise<string>;
|
|
32
|
-
export declare function execAsync(command: string, options: ExecOptions): Promise<string>;
|
|
33
|
-
export declare function execAsync(command: string, options: (ObjectEncodingOptions & ExecOptions) | undefined | null): Promise<string | Buffer>;
|
|
34
|
-
export declare function execAsync(command: string, options: (ObjectEncodingOptions & ExecOptions & {
|
|
35
|
-
decode: IconvDecodeOptions;
|
|
36
|
-
}) | undefined | null): Promise<string>;
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
|
|
29
|
-
// src/utils/execAsync.ts
|
|
30
|
-
var execAsync_exports = {};
|
|
31
|
-
__export(execAsync_exports, {
|
|
32
|
-
execAsync: () => execAsync
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(execAsync_exports);
|
|
35
|
-
var import_child_process = require("child_process");
|
|
36
|
-
var import_iconv_lite = __toESM(require("iconv-lite"));
|
|
37
|
-
async function execAsync(command, options) {
|
|
38
|
-
const decode = options?.decode;
|
|
39
|
-
if (typeof options === "object" && options !== null && options.decode) {
|
|
40
|
-
const { decode: decode2, ...rest } = options;
|
|
41
|
-
options = rest;
|
|
42
|
-
}
|
|
43
|
-
return await new Promise((resolve, reject) => {
|
|
44
|
-
(0, import_child_process.exec)(command, options, (error, stdout, stderr) => {
|
|
45
|
-
if (error)
|
|
46
|
-
return reject(error);
|
|
47
|
-
if (decode && stdout instanceof Buffer)
|
|
48
|
-
return resolve(import_iconv_lite.default.decode(stdout, decode.encoding, decode.options));
|
|
49
|
-
resolve(stdout);
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
54
|
-
0 && (module.exports = {
|
|
55
|
-
execAsync
|
|
56
|
-
});
|
|
57
|
-
//# sourceMappingURL=execAsync.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/utils/execAsync.ts"],
|
|
4
|
-
"sourcesContent": ["import { ExecOptions, exec } from \"child_process\"\nimport { ObjectEncodingOptions } from \"fs\"\nimport iconv, { Options } from \"iconv-lite\"\n\nexport type IconvDecodeOptions = {\n encoding: string\n options?: Options\n}\n\nexport async function execAsync(command: string): Promise<string>\nexport async function execAsync(command: string, options: { encoding: \"buffer\" | null } & ExecOptions): Promise<Buffer>\nexport async function execAsync(command: string, options: { encoding: \"buffer\" | null } & ExecOptions & { decode: IconvDecodeOptions }): Promise<string>\nexport async function execAsync(command: string, options: { encoding: BufferEncoding } & ExecOptions): Promise<string>\nexport async function execAsync(command: string, options: { encoding: BufferEncoding } & ExecOptions): Promise<string | Buffer>\nexport async function execAsync(command: string, options: { encoding: BufferEncoding } & ExecOptions & { decode: IconvDecodeOptions }): Promise<string>\nexport async function execAsync(command: string, options: ExecOptions): Promise<string>\nexport async function execAsync(command: string, options: (ObjectEncodingOptions & ExecOptions) | undefined | null): Promise<string | Buffer>\nexport async function execAsync(\n command: string,\n options: (ObjectEncodingOptions & ExecOptions & { decode: IconvDecodeOptions }) | undefined | null,\n): Promise<string>\nexport async function execAsync(command: string, options?: any) {\n const decode = options?.decode as IconvDecodeOptions | undefined\n if (typeof options === \"object\" && options !== null && options.decode) {\n const { decode, ...rest } = options as { decode: IconvDecodeOptions }\n options = rest\n }\n return await new Promise<string | Buffer>((resolve, reject) => {\n exec(command, options, (error, stdout, stderr) => {\n if (error) return reject(error)\n // if (stderr) console.warn(stderr)\n if (decode && stdout instanceof Buffer) return resolve(iconv.decode(stdout, decode.encoding, decode.options))\n resolve(stdout)\n })\n })\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BAAkC;AAElC,wBAA+B;AAmB/B,eAAsB,UAAU,SAAiB,SAAe;AAC5D,QAAM,SAAS,SAAS;AACxB,MAAI,OAAO,YAAY,YAAY,YAAY,QAAQ,QAAQ,QAAQ;AACnE,UAAM,EAAE,QAAAA,SAAQ,GAAG,KAAK,IAAI;AAC5B,cAAU;AAAA,EACd;AACA,SAAO,MAAM,IAAI,QAAyB,CAAC,SAAS,WAAW;AAC3D,mCAAK,SAAS,SAAS,CAAC,OAAO,QAAQ,WAAW;AAC9C,UAAI;AAAO,eAAO,OAAO,KAAK;AAE9B,UAAI,UAAU,kBAAkB;AAAQ,eAAO,QAAQ,kBAAAC,QAAM,OAAO,QAAQ,OAAO,UAAU,OAAO,OAAO,CAAC;AAC5G,cAAQ,MAAM;AAAA,IAClB,CAAC;AAAA,EACL,CAAC;AACL;",
|
|
6
|
-
"names": ["decode", "iconv"]
|
|
7
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
|
|
19
|
-
// src/utils/saveFile.ts
|
|
20
|
-
var saveFile_exports = {};
|
|
21
|
-
__export(saveFile_exports, {
|
|
22
|
-
saveFile: () => saveFile
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(saveFile_exports);
|
|
25
|
-
var import_fs = require("fs");
|
|
26
|
-
var import_stream = require("stream");
|
|
27
|
-
async function saveFile({ input, output }) {
|
|
28
|
-
await new Promise((resolve, reject) => {
|
|
29
|
-
const writeAble = (0, import_fs.createWriteStream)(output);
|
|
30
|
-
import_stream.Readable.fromWeb(input.stream()).pipe(writeAble).on("finish", resolve).on("error", reject);
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
34
|
-
0 && (module.exports = {
|
|
35
|
-
saveFile
|
|
36
|
-
});
|
|
37
|
-
//# sourceMappingURL=saveFile.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/utils/saveFile.ts"],
|
|
4
|
-
"sourcesContent": ["import { createWriteStream } from \"fs\"\nimport { Readable } from \"stream\"\n\nexport type SaveFileOptions = {\n /** 要保存的文件 */\n input: File\n /** 保存文件的目标位置 */\n output: string\n}\n\n/**\n * 保存文件\n */\nexport async function saveFile({ input, output }: SaveFileOptions) {\n await new Promise<void>((resolve, reject) => {\n const writeAble = createWriteStream(output)\n Readable.fromWeb(input.stream() as any)\n .pipe(writeAble)\n .on(\"finish\", resolve)\n .on(\"error\", reject)\n })\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAAkC;AAClC,oBAAyB;AAYzB,eAAsB,SAAS,EAAE,OAAO,OAAO,GAAoB;AAC/D,QAAM,IAAI,QAAc,CAAC,SAAS,WAAW;AACzC,UAAM,gBAAY,6BAAkB,MAAM;AAC1C,2BAAS,QAAQ,MAAM,OAAO,CAAQ,EACjC,KAAK,SAAS,EACd,GAAG,UAAU,OAAO,EACpB,GAAG,SAAS,MAAM;AAAA,EAC3B,CAAC;AACL;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
-
var __export = (target, all) => {
|
|
6
|
-
for (var name in all)
|
|
7
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
-
};
|
|
9
|
-
var __copyProps = (to, from, except, desc) => {
|
|
10
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
-
for (let key of __getOwnPropNames(from))
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
-
}
|
|
15
|
-
return to;
|
|
16
|
-
};
|
|
17
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
-
|
|
19
|
-
// src/utils/saveResponse.ts
|
|
20
|
-
var saveResponse_exports = {};
|
|
21
|
-
__export(saveResponse_exports, {
|
|
22
|
-
saveResponse: () => saveResponse
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(saveResponse_exports);
|
|
25
|
-
var import_fs = require("fs");
|
|
26
|
-
var import_stream = require("stream");
|
|
27
|
-
async function saveResponse(response, file) {
|
|
28
|
-
const writeable = (0, import_fs.createWriteStream)(file);
|
|
29
|
-
await new Promise(
|
|
30
|
-
(resolve, reject) => import_stream.Readable.fromWeb(response.body).pipe(writeable).on("close", resolve).on("error", reject)
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
34
|
-
0 && (module.exports = {
|
|
35
|
-
saveResponse
|
|
36
|
-
});
|
|
37
|
-
//# sourceMappingURL=saveResponse.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/utils/saveResponse.ts"],
|
|
4
|
-
"sourcesContent": ["import { createWriteStream } from \"fs\"\nimport { Readable } from \"stream\"\n\n/**\n * 从 Response 对象中下载文件\n * @param response Response 对象\n * @param file 文件路径\n */\nexport async function saveResponse(response: Response, file: string) {\n const writeable = createWriteStream(file)\n await new Promise<void>((resolve, reject) =>\n Readable.fromWeb(response.body! as any)\n .pipe(writeable)\n .on(\"close\", resolve)\n .on(\"error\", reject),\n )\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAAkC;AAClC,oBAAyB;AAOzB,eAAsB,aAAa,UAAoB,MAAc;AACjE,QAAM,gBAAY,6BAAkB,IAAI;AACxC,QAAM,IAAI;AAAA,IAAc,CAAC,SAAS,WAC9B,uBAAS,QAAQ,SAAS,IAAY,EACjC,KAAK,SAAS,EACd,GAAG,SAAS,OAAO,EACnB,GAAG,SAAS,MAAM;AAAA,EAC3B;AACJ;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|