soda-nodejs 0.1.1 → 0.1.2
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/cjs/utils/unzip.d.ts +1 -1
- package/dist/cjs/utils/unzip.js +1 -1
- package/dist/cjs/utils/unzip.js.map +2 -2
- package/dist/cjs/utils/zip.d.ts +1 -1
- package/dist/cjs/utils/zip.js +1 -1
- package/dist/cjs/utils/zip.js.map +2 -2
- package/dist/esm/utils/unzip.d.ts +1 -1
- package/dist/esm/utils/unzip.js +1 -1
- package/dist/esm/utils/unzip.js.map +1 -1
- package/dist/esm/utils/zip.d.ts +1 -1
- package/dist/esm/utils/zip.js +1 -1
- package/dist/esm/utils/zip.js.map +1 -1
- package/package.json +1 -1
- package/src/utils/unzip.ts +1 -1
- package/src/utils/zip.ts +1 -1
|
@@ -11,4 +11,4 @@ export type UnzipOptions = {
|
|
|
11
11
|
/**
|
|
12
12
|
* 解压文件
|
|
13
13
|
*/
|
|
14
|
-
export declare function unzip({ source, target }: UnzipOptions): Promise<import("./execAsync").ExecResult<string
|
|
14
|
+
export declare function unzip({ source, target }: UnzipOptions): Promise<import("./execAsync").ExecResult<string>>;
|
package/dist/cjs/utils/unzip.js
CHANGED
|
@@ -28,7 +28,7 @@ var import_install7zip = require("./install7zip");
|
|
|
28
28
|
async function unzip({ source, target }) {
|
|
29
29
|
if (!await (0, import_check7zip.check7zip)()) {
|
|
30
30
|
(0, import_install7zip.install7zip)();
|
|
31
|
-
|
|
31
|
+
throw new Error("检测不到 7z 命令");
|
|
32
32
|
}
|
|
33
33
|
return await (0, import_execAsync.execAsync)(`7z x ${source} -o${target}`);
|
|
34
34
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/utils/unzip.ts"],
|
|
4
|
-
"sourcesContent": ["import { check7zip } from \"./check7zip\"\r\nimport { execAsync } from \"./execAsync\"\r\nimport { install7zip } from \"./install7zip\"\r\n\r\nexport type UnzipOptions = {\r\n /**\r\n * 要解压的文件\r\n */\r\n source: string\r\n /**\r\n * 解压到的目标位置\r\n */\r\n target: string\r\n}\r\n\r\n/**\r\n * 解压文件\r\n */\r\nexport async function unzip({ source, target }: UnzipOptions) {\r\n if (!(await check7zip())) {\r\n install7zip()\r\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAA0B;AAC1B,uBAA0B;AAC1B,yBAA4B;AAgB5B,eAAsB,MAAM,EAAE,QAAQ,OAAO,GAAiB;AAC1D,MAAI,CAAE,UAAM,4BAAU,GAAI;AACtB,wCAAY;AACZ;AAAA,
|
|
4
|
+
"sourcesContent": ["import { check7zip } from \"./check7zip\"\r\nimport { execAsync } from \"./execAsync\"\r\nimport { install7zip } from \"./install7zip\"\r\n\r\nexport type UnzipOptions = {\r\n /**\r\n * 要解压的文件\r\n */\r\n source: string\r\n /**\r\n * 解压到的目标位置\r\n */\r\n target: string\r\n}\r\n\r\n/**\r\n * 解压文件\r\n */\r\nexport async function unzip({ source, target }: UnzipOptions) {\r\n if (!(await check7zip())) {\r\n install7zip()\r\n throw new Error(\"检测不到 7z 命令\")\r\n }\r\n return await execAsync(`7z x ${source} -o${target}`)\r\n}\r\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAA0B;AAC1B,uBAA0B;AAC1B,yBAA4B;AAgB5B,eAAsB,MAAM,EAAE,QAAQ,OAAO,GAAiB;AAC1D,MAAI,CAAE,UAAM,4BAAU,GAAI;AACtB,wCAAY;AACZ,UAAM,IAAI,MAAM,YAAY;AAAA,EAChC;AACA,SAAO,UAAM,4BAAU,QAAQ,YAAY,QAAQ;AACvD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/dist/cjs/utils/zip.d.ts
CHANGED
|
@@ -20,4 +20,4 @@ export type ZipOptions = {
|
|
|
20
20
|
*/
|
|
21
21
|
password?: string;
|
|
22
22
|
};
|
|
23
|
-
export declare function zip({ source, target, thread, level, password }: ZipOptions): Promise<import("./execAsync").ExecResult<string
|
|
23
|
+
export declare function zip({ source, target, thread, level, password }: ZipOptions): Promise<import("./execAsync").ExecResult<string>>;
|
package/dist/cjs/utils/zip.js
CHANGED
|
@@ -29,7 +29,7 @@ var import_install7zip = require("./install7zip");
|
|
|
29
29
|
async function zip({ source, target, thread = "auto", level, password }) {
|
|
30
30
|
if (!await (0, import_check7zip.check7zip)()) {
|
|
31
31
|
(0, import_install7zip.install7zip)();
|
|
32
|
-
|
|
32
|
+
throw new Error("检测不到 7z 命令");
|
|
33
33
|
}
|
|
34
34
|
source = Array.isArray(source) ? source.join(" ") : source;
|
|
35
35
|
const cpuCount = (0, import_os.cpus)().length;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/utils/zip.ts"],
|
|
4
|
-
"sourcesContent": ["import { cpus } from \"os\"\r\nimport { execAsync } from \"./execAsync\"\r\nimport { check7zip } from \"./check7zip\"\r\nimport { install7zip } from \"./install7zip\"\r\n\r\nexport type ZipOptions = {\r\n /**\r\n * 要压缩的文件\r\n */\r\n source: string | string[]\r\n /**\r\n * 压缩到的目标位置\r\n */\r\n target: string\r\n /**\r\n * 线程数\r\n */\r\n thread?: number | \"auto\" | \"max\"\r\n /**\r\n * 压缩等级,0-9\r\n */\r\n level?: number\r\n /**\r\n * 是否加密\r\n */\r\n password?: string\r\n}\r\n\r\nexport async function zip({ source, target, thread = \"auto\", level, password }: ZipOptions) {\r\n if (!(await check7zip())) {\r\n install7zip()\r\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAAqB;AACrB,uBAA0B;AAC1B,uBAA0B;AAC1B,yBAA4B;AAyB5B,eAAsB,IAAI,EAAE,QAAQ,QAAQ,SAAS,QAAQ,OAAO,SAAS,GAAe;AACxF,MAAI,CAAE,UAAM,4BAAU,GAAI;AACtB,wCAAY;AACZ;AAAA,
|
|
4
|
+
"sourcesContent": ["import { cpus } from \"os\"\r\nimport { execAsync } from \"./execAsync\"\r\nimport { check7zip } from \"./check7zip\"\r\nimport { install7zip } from \"./install7zip\"\r\n\r\nexport type ZipOptions = {\r\n /**\r\n * 要压缩的文件\r\n */\r\n source: string | string[]\r\n /**\r\n * 压缩到的目标位置\r\n */\r\n target: string\r\n /**\r\n * 线程数\r\n */\r\n thread?: number | \"auto\" | \"max\"\r\n /**\r\n * 压缩等级,0-9\r\n */\r\n level?: number\r\n /**\r\n * 是否加密\r\n */\r\n password?: string\r\n}\r\n\r\nexport async function zip({ source, target, thread = \"auto\", level, password }: ZipOptions) {\r\n if (!(await check7zip())) {\r\n install7zip()\r\n throw new Error(\"检测不到 7z 命令\")\r\n }\r\n source = Array.isArray(source) ? source.join(\" \") : source\r\n const cpuCount = cpus().length\r\n if (thread === \"max\") thread = cpuCount\r\n return await execAsync(`7z a ${target} ${source} -mmt=${thread === \"auto\" ? \"on\" : thread}${typeof level === \"number\" ? ` -mx=${level}` : \"\"}${password ? ` -p${password}` : \"\"}`)\r\n}\r\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAAqB;AACrB,uBAA0B;AAC1B,uBAA0B;AAC1B,yBAA4B;AAyB5B,eAAsB,IAAI,EAAE,QAAQ,QAAQ,SAAS,QAAQ,OAAO,SAAS,GAAe;AACxF,MAAI,CAAE,UAAM,4BAAU,GAAI;AACtB,wCAAY;AACZ,UAAM,IAAI,MAAM,YAAY;AAAA,EAChC;AACA,WAAS,MAAM,QAAQ,MAAM,IAAI,OAAO,KAAK,GAAG,IAAI;AACpD,QAAM,eAAW,gBAAK,EAAE;AACxB,MAAI,WAAW;AAAO,aAAS;AAC/B,SAAO,UAAM,4BAAU,QAAQ,UAAU,eAAe,WAAW,SAAS,OAAO,SAAS,OAAO,UAAU,WAAW,QAAQ,UAAU,KAAK,WAAW,MAAM,aAAa,IAAI;AACrL;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -11,4 +11,4 @@ export type UnzipOptions = {
|
|
|
11
11
|
/**
|
|
12
12
|
* 解压文件
|
|
13
13
|
*/
|
|
14
|
-
export declare function unzip({ source, target }: UnzipOptions): Promise<import("./execAsync").ExecResult<string
|
|
14
|
+
export declare function unzip({ source, target }: UnzipOptions): Promise<import("./execAsync").ExecResult<string>>;
|
package/dist/esm/utils/unzip.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["check7zip","execAsync","install7zip","unzip","source","target"],"sources":["../../../src/utils/unzip.ts"],"sourcesContent":["import { check7zip } from \"./check7zip\"\r\nimport { execAsync } from \"./execAsync\"\r\nimport { install7zip } from \"./install7zip\"\r\n\r\nexport type UnzipOptions = {\r\n /**\r\n * 要解压的文件\r\n */\r\n source: string\r\n /**\r\n * 解压到的目标位置\r\n */\r\n target: string\r\n}\r\n\r\n/**\r\n * 解压文件\r\n */\r\nexport async function unzip({ source, target }: UnzipOptions) {\r\n if (!(await check7zip())) {\r\n install7zip()\r\n
|
|
1
|
+
{"version":3,"names":["check7zip","execAsync","install7zip","unzip","source","target","Error"],"sources":["../../../src/utils/unzip.ts"],"sourcesContent":["import { check7zip } from \"./check7zip\"\r\nimport { execAsync } from \"./execAsync\"\r\nimport { install7zip } from \"./install7zip\"\r\n\r\nexport type UnzipOptions = {\r\n /**\r\n * 要解压的文件\r\n */\r\n source: string\r\n /**\r\n * 解压到的目标位置\r\n */\r\n target: string\r\n}\r\n\r\n/**\r\n * 解压文件\r\n */\r\nexport async function unzip({ source, target }: UnzipOptions) {\r\n if (!(await check7zip())) {\r\n install7zip()\r\n throw new Error(\"检测不到 7z 命令\")\r\n }\r\n return await execAsync(`7z x ${source} -o${target}`)\r\n}\r\n"],"mappings":"AAAA,SAASA,SAAS;AAClB,SAASC,SAAS;AAClB,SAASC,WAAW;AAapB;AACA;AACA;AACA,OAAO,eAAeC,KAAKA,CAAC;EAAEC,MAAM;EAAEC;AAAqB,CAAC,EAAE;EAC1D,IAAI,EAAE,MAAML,SAAS,CAAC,CAAC,CAAC,EAAE;IACtBE,WAAW,CAAC,CAAC;IACb,MAAM,IAAII,KAAK,CAAC,YAAY,CAAC;EACjC;EACA,OAAO,MAAML,SAAS,CAAE,QAAOG,MAAO,MAAKC,MAAO,EAAC,CAAC;AACxD"}
|
package/dist/esm/utils/zip.d.ts
CHANGED
|
@@ -20,4 +20,4 @@ export type ZipOptions = {
|
|
|
20
20
|
*/
|
|
21
21
|
password?: string;
|
|
22
22
|
};
|
|
23
|
-
export declare function zip({ source, target, thread, level, password }: ZipOptions): Promise<import("./execAsync").ExecResult<string
|
|
23
|
+
export declare function zip({ source, target, thread, level, password }: ZipOptions): Promise<import("./execAsync").ExecResult<string>>;
|
package/dist/esm/utils/zip.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["cpus","execAsync","check7zip","install7zip","zip","source","target","thread","level","password","Array","isArray","join","cpuCount","length"],"sources":["../../../src/utils/zip.ts"],"sourcesContent":["import { cpus } from \"os\"\r\nimport { execAsync } from \"./execAsync\"\r\nimport { check7zip } from \"./check7zip\"\r\nimport { install7zip } from \"./install7zip\"\r\n\r\nexport type ZipOptions = {\r\n /**\r\n * 要压缩的文件\r\n */\r\n source: string | string[]\r\n /**\r\n * 压缩到的目标位置\r\n */\r\n target: string\r\n /**\r\n * 线程数\r\n */\r\n thread?: number | \"auto\" | \"max\"\r\n /**\r\n * 压缩等级,0-9\r\n */\r\n level?: number\r\n /**\r\n * 是否加密\r\n */\r\n password?: string\r\n}\r\n\r\nexport async function zip({ source, target, thread = \"auto\", level, password }: ZipOptions) {\r\n if (!(await check7zip())) {\r\n install7zip()\r\n
|
|
1
|
+
{"version":3,"names":["cpus","execAsync","check7zip","install7zip","zip","source","target","thread","level","password","Error","Array","isArray","join","cpuCount","length"],"sources":["../../../src/utils/zip.ts"],"sourcesContent":["import { cpus } from \"os\"\r\nimport { execAsync } from \"./execAsync\"\r\nimport { check7zip } from \"./check7zip\"\r\nimport { install7zip } from \"./install7zip\"\r\n\r\nexport type ZipOptions = {\r\n /**\r\n * 要压缩的文件\r\n */\r\n source: string | string[]\r\n /**\r\n * 压缩到的目标位置\r\n */\r\n target: string\r\n /**\r\n * 线程数\r\n */\r\n thread?: number | \"auto\" | \"max\"\r\n /**\r\n * 压缩等级,0-9\r\n */\r\n level?: number\r\n /**\r\n * 是否加密\r\n */\r\n password?: string\r\n}\r\n\r\nexport async function zip({ source, target, thread = \"auto\", level, password }: ZipOptions) {\r\n if (!(await check7zip())) {\r\n install7zip()\r\n throw new Error(\"检测不到 7z 命令\")\r\n }\r\n source = Array.isArray(source) ? source.join(\" \") : source\r\n const cpuCount = cpus().length\r\n if (thread === \"max\") thread = cpuCount\r\n return await execAsync(`7z a ${target} ${source} -mmt=${thread === \"auto\" ? \"on\" : thread}${typeof level === \"number\" ? ` -mx=${level}` : \"\"}${password ? ` -p${password}` : \"\"}`)\r\n}\r\n"],"mappings":"AAAA,SAASA,IAAI,QAAQ,IAAI;AACzB,SAASC,SAAS;AAClB,SAASC,SAAS;AAClB,SAASC,WAAW;AAyBpB,OAAO,eAAeC,GAAGA,CAAC;EAAEC,MAAM;EAAEC,MAAM;EAAEC,MAAM,GAAG,MAAM;EAAEC,KAAK;EAAEC;AAAqB,CAAC,EAAE;EACxF,IAAI,EAAE,MAAMP,SAAS,CAAC,CAAC,CAAC,EAAE;IACtBC,WAAW,CAAC,CAAC;IACb,MAAM,IAAIO,KAAK,CAAC,YAAY,CAAC;EACjC;EACAL,MAAM,GAAGM,KAAK,CAACC,OAAO,CAACP,MAAM,CAAC,GAAGA,MAAM,CAACQ,IAAI,CAAC,GAAG,CAAC,GAAGR,MAAM;EAC1D,MAAMS,QAAQ,GAAGd,IAAI,CAAC,CAAC,CAACe,MAAM;EAC9B,IAAIR,MAAM,KAAK,KAAK,EAAEA,MAAM,GAAGO,QAAQ;EACvC,OAAO,MAAMb,SAAS,CAAE,QAAOK,MAAO,IAAGD,MAAO,SAAQE,MAAM,KAAK,MAAM,GAAG,IAAI,GAAGA,MAAO,GAAE,OAAOC,KAAK,KAAK,QAAQ,GAAI,QAAOA,KAAM,EAAC,GAAG,EAAG,GAAEC,QAAQ,GAAI,MAAKA,QAAS,EAAC,GAAG,EAAG,EAAC,CAAC;AACtL"}
|
package/package.json
CHANGED
package/src/utils/unzip.ts
CHANGED
package/src/utils/zip.ts
CHANGED
|
@@ -29,7 +29,7 @@ export type ZipOptions = {
|
|
|
29
29
|
export async function zip({ source, target, thread = "auto", level, password }: ZipOptions) {
|
|
30
30
|
if (!(await check7zip())) {
|
|
31
31
|
install7zip()
|
|
32
|
-
|
|
32
|
+
throw new Error("检测不到 7z 命令")
|
|
33
33
|
}
|
|
34
34
|
source = Array.isArray(source) ? source.join(" ") : source
|
|
35
35
|
const cpuCount = cpus().length
|