soda-nodejs 0.1.0 → 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.
@@ -1,2 +1,7 @@
1
+ export * from "./utils/check7zip";
1
2
  export * from "./utils/execAsync";
3
+ export * from "./utils/install7zip";
4
+ export * from "./utils/saveFile";
2
5
  export * from "./utils/spawnAsync";
6
+ export * from "./utils/unzip";
7
+ export * from "./utils/zip";
package/dist/cjs/index.js CHANGED
@@ -16,11 +16,21 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
16
16
  // src/index.ts
17
17
  var src_exports = {};
18
18
  module.exports = __toCommonJS(src_exports);
19
+ __reExport(src_exports, require("./utils/check7zip"), module.exports);
19
20
  __reExport(src_exports, require("./utils/execAsync"), module.exports);
21
+ __reExport(src_exports, require("./utils/install7zip"), module.exports);
22
+ __reExport(src_exports, require("./utils/saveFile"), module.exports);
20
23
  __reExport(src_exports, require("./utils/spawnAsync"), module.exports);
24
+ __reExport(src_exports, require("./utils/unzip"), module.exports);
25
+ __reExport(src_exports, require("./utils/zip"), module.exports);
21
26
  // Annotate the CommonJS export names for ESM import in node:
22
27
  0 && (module.exports = {
28
+ ...require("./utils/check7zip"),
23
29
  ...require("./utils/execAsync"),
24
- ...require("./utils/spawnAsync")
30
+ ...require("./utils/install7zip"),
31
+ ...require("./utils/saveFile"),
32
+ ...require("./utils/spawnAsync"),
33
+ ...require("./utils/unzip"),
34
+ ...require("./utils/zip")
25
35
  });
26
36
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.ts"],
4
- "sourcesContent": ["export * from \"@utils/execAsync\"\nexport * from \"@utils/spawnAsync\"\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,wBAAc,8BAAd;AACA,wBAAc,+BADd;",
4
+ "sourcesContent": ["export * from \"@utils/check7zip\"\nexport * from \"@utils/execAsync\"\nexport * from \"@utils/install7zip\"\nexport * from \"@utils/saveFile\"\nexport * from \"@utils/spawnAsync\"\nexport * from \"@utils/unzip\"\nexport * from \"@utils/zip\"\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,wBAAc,8BAAd;AACA,wBAAc,8BADd;AAEA,wBAAc,gCAFd;AAGA,wBAAc,6BAHd;AAIA,wBAAc,+BAJd;AAKA,wBAAc,0BALd;AAMA,wBAAc,wBANd;",
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> | undefined>;
14
+ export declare function unzip({ source, target }: UnzipOptions): Promise<import("./execAsync").ExecResult<string>>;
@@ -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
- return;
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 return\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;AAAA,EACJ;AACA,SAAO,UAAM,4BAAU,QAAQ,YAAY,QAAQ;AACvD;",
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
  }
@@ -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> | undefined>;
23
+ export declare function zip({ source, target, thread, level, password }: ZipOptions): Promise<import("./execAsync").ExecResult<string>>;
@@ -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
- return;
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 return\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;AAAA,EACJ;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;",
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
  }
@@ -1,2 +1,7 @@
1
+ export * from "./utils/check7zip";
1
2
  export * from "./utils/execAsync";
3
+ export * from "./utils/install7zip";
4
+ export * from "./utils/saveFile";
2
5
  export * from "./utils/spawnAsync";
6
+ export * from "./utils/unzip";
7
+ export * from "./utils/zip";
package/dist/esm/index.js CHANGED
@@ -1,3 +1,8 @@
1
+ export * from "./utils/check7zip";
1
2
  export * from "./utils/execAsync";
3
+ export * from "./utils/install7zip";
4
+ export * from "./utils/saveFile";
2
5
  export * from "./utils/spawnAsync";
6
+ export * from "./utils/unzip";
7
+ export * from "./utils/zip";
3
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":["export * from \"@utils/execAsync\"\nexport * from \"@utils/spawnAsync\"\n"],"mappings":"AAAA;AACA"}
1
+ {"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":["export * from \"@utils/check7zip\"\nexport * from \"@utils/execAsync\"\nexport * from \"@utils/install7zip\"\nexport * from \"@utils/saveFile\"\nexport * from \"@utils/spawnAsync\"\nexport * from \"@utils/unzip\"\nexport * from \"@utils/zip\"\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA"}
@@ -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> | undefined>;
14
+ export declare function unzip({ source, target }: UnzipOptions): Promise<import("./execAsync").ExecResult<string>>;
@@ -10,7 +10,7 @@ export async function unzip({
10
10
  }) {
11
11
  if (!(await check7zip())) {
12
12
  install7zip();
13
- return;
13
+ throw new Error("检测不到 7z 命令");
14
14
  }
15
15
  return await execAsync(`7z x ${source} -o${target}`);
16
16
  }
@@ -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 return\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;EACJ;EACA,OAAO,MAAMD,SAAS,CAAE,QAAOG,MAAO,MAAKC,MAAO,EAAC,CAAC;AACxD"}
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"}
@@ -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> | undefined>;
23
+ export declare function zip({ source, target, thread, level, password }: ZipOptions): Promise<import("./execAsync").ExecResult<string>>;
@@ -11,7 +11,7 @@ export async function zip({
11
11
  }) {
12
12
  if (!(await check7zip())) {
13
13
  install7zip();
14
- return;
14
+ throw new Error("检测不到 7z 命令");
15
15
  }
16
16
  source = Array.isArray(source) ? source.join(" ") : source;
17
17
  const cpuCount = cpus().length;
@@ -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 return\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;EACJ;EACAE,MAAM,GAAGK,KAAK,CAACC,OAAO,CAACN,MAAM,CAAC,GAAGA,MAAM,CAACO,IAAI,CAAC,GAAG,CAAC,GAAGP,MAAM;EAC1D,MAAMQ,QAAQ,GAAGb,IAAI,CAAC,CAAC,CAACc,MAAM;EAC9B,IAAIP,MAAM,KAAK,KAAK,EAAEA,MAAM,GAAGM,QAAQ;EACvC,OAAO,MAAMZ,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"}
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "soda-nodejs",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
package/src/index.ts CHANGED
@@ -1,2 +1,7 @@
1
+ export * from "@utils/check7zip"
1
2
  export * from "@utils/execAsync"
3
+ export * from "@utils/install7zip"
4
+ export * from "@utils/saveFile"
2
5
  export * from "@utils/spawnAsync"
6
+ export * from "@utils/unzip"
7
+ export * from "@utils/zip"
@@ -19,7 +19,7 @@ export type UnzipOptions = {
19
19
  export async function unzip({ source, target }: UnzipOptions) {
20
20
  if (!(await check7zip())) {
21
21
  install7zip()
22
- return
22
+ throw new Error("检测不到 7z 命令")
23
23
  }
24
24
  return await execAsync(`7z x ${source} -o${target}`)
25
25
  }
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
- return
32
+ throw new Error("检测不到 7z 命令")
33
33
  }
34
34
  source = Array.isArray(source) ? source.join(" ") : source
35
35
  const cpuCount = cpus().length