soda-nodejs 0.4.1 → 0.4.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,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/index.ts"],
4
- "sourcesContent": ["export * 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"],
4
+ "sourcesContent": ["export * 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
5
  "mappings": ";;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,wBAAc,yBAAd;AACA,wBAAc,8BADd;AAEA,wBAAc,6BAFd;AAGA,wBAAc,iCAHd;AAIA,wBAAc,+BAJd;AAKA,wBAAc,0BALd;AAMA,wBAAc,wBANd;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/utils/execAsync.ts"],
4
- "sourcesContent": ["import { exec, ExecOptions } 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"],
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
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
6
  "names": ["decode", "iconv"]
7
7
  }
@@ -1,5 +1,5 @@
1
1
  /// <reference types="node" />
2
- import { SpawnOptions, SpawnOptionsWithoutStdio, SpawnOptionsWithStdioTuple, StdioNull, StdioPipe } from "child_process";
2
+ import { SpawnOptions, SpawnOptionsWithStdioTuple, SpawnOptionsWithoutStdio, StdioNull, StdioPipe } from "child_process";
3
3
  export declare function spawnAsync(command: string, options?: SpawnOptionsWithoutStdio): Promise<void>;
4
4
  export declare function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>): Promise<void>;
5
5
  export declare function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>): Promise<void>;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/utils/spawnAsync.ts"],
4
- "sourcesContent": ["import { spawn, SpawnOptions, SpawnOptionsWithoutStdio, SpawnOptionsWithStdioTuple, StdioNull, StdioPipe } from \"child_process\"\n\nexport function spawnAsync(command: string, options?: SpawnOptionsWithoutStdio): Promise<void>\nexport function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>): Promise<void>\nexport function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>): Promise<void>\nexport function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>): Promise<void>\nexport function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>): Promise<void>\nexport function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>): Promise<void>\nexport function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>): Promise<void>\nexport function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>): Promise<void>\nexport function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>): Promise<void>\nexport function spawnAsync(command: string, options: SpawnOptions): Promise<void>\nexport function spawnAsync(command: string, args?: readonly string[], options?: SpawnOptionsWithoutStdio): Promise<void>\nexport function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>): Promise<void>\nexport function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>): Promise<void>\nexport function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>): Promise<void>\nexport function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>): Promise<void>\nexport function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>): Promise<void>\nexport function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>): Promise<void>\nexport function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>): Promise<void>\nexport function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>): Promise<void>\nexport function spawnAsync(command: string, args: readonly string[], options: SpawnOptions): Promise<void>\nexport async function spawnAsync(command: string, args?: any, options?: any) {\n await new Promise<void>((resolve, reject) => {\n const child = spawn(command, args, options)\n child.on(\"exit\", code => {\n if (code !== 0) {\n reject(new Error(`\"${command}\" Command failed with code ${code}`))\n return\n }\n resolve()\n })\n })\n}\n"],
4
+ "sourcesContent": ["import { SpawnOptions, SpawnOptionsWithStdioTuple, SpawnOptionsWithoutStdio, StdioNull, StdioPipe, spawn } from \"child_process\"\n\nexport function spawnAsync(command: string, options?: SpawnOptionsWithoutStdio): Promise<void>\nexport function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>): Promise<void>\nexport function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>): Promise<void>\nexport function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>): Promise<void>\nexport function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>): Promise<void>\nexport function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>): Promise<void>\nexport function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>): Promise<void>\nexport function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>): Promise<void>\nexport function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>): Promise<void>\nexport function spawnAsync(command: string, options: SpawnOptions): Promise<void>\nexport function spawnAsync(command: string, args?: readonly string[], options?: SpawnOptionsWithoutStdio): Promise<void>\nexport function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>): Promise<void>\nexport function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>): Promise<void>\nexport function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>): Promise<void>\nexport function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>): Promise<void>\nexport function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>): Promise<void>\nexport function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>): Promise<void>\nexport function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>): Promise<void>\nexport function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>): Promise<void>\nexport function spawnAsync(command: string, args: readonly string[], options: SpawnOptions): Promise<void>\nexport async function spawnAsync(command: string, args?: any, options?: any) {\n await new Promise<void>((resolve, reject) => {\n const child = spawn(command, args, options)\n child.on(\"exit\", code => {\n if (code !== 0) {\n reject(new Error(`\"${command}\" Command failed with code ${code}`))\n return\n }\n resolve()\n })\n })\n}\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BAAgH;AAsBhH,eAAsB,WAAW,SAAiB,MAAY,SAAe;AACzE,QAAM,IAAI,QAAc,CAAC,SAAS,WAAW;AACzC,UAAM,YAAQ,4BAAM,SAAS,MAAM,OAAO;AAC1C,UAAM,GAAG,QAAQ,UAAQ;AACrB,UAAI,SAAS,GAAG;AACZ,eAAO,IAAI,MAAM,IAAI,qCAAqC,MAAM,CAAC;AACjE;AAAA,MACJ;AACA,cAAQ;AAAA,IACZ,CAAC;AAAA,EACL,CAAC;AACL;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/utils/unzip.ts"],
4
- "sourcesContent": ["import which from \"which\"\nimport { execAsync } from \"./execAsync\"\n\nexport type UnzipOptions = {\n /**\n * 要解压的文件\n */\n input: string\n /**\n * 解压到的目标文件夹位置\n */\n output: string\n /**\n * 压缩文件时的工作目录\n */\n cwd?: string\n}\n\n/**\n * 使用 7z 命令解压文件\n * - 如果没有安装 7z,请先安装 7z 后再执行\n * - 下载地址:https://www.7-zip.org/download.html\n * - 如果已经安装,请按照以下步骤将 7z 添加到环境变量中\n * 1. 设置 → 系统 → 右侧系统信息 → 高级系统设置 → 环境变量\n * 2. 在系统变量中找到并选中 Path,点击编辑\n * 3. 点击新建,输入 7z 的安装路径(默认是 C:\\Program Files\\7-Zip),点击确定\n * 4. 重启终端,输入 7z,如果出现 7z 的版本信息,则安装成功\n * 5. 如果没有出现版本信息,请重启电脑,或者检查 7z 的安装路径是否正确\n */\nexport async function unzip({ input, output, cwd }: UnzipOptions) {\n await which(\"7z\")\n return await execAsync(`7z x ${input} -o${output}`, { cwd })\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAClB,uBAA0B;AA4B1B,eAAsB,MAAM,EAAE,OAAO,QAAQ,IAAI,GAAiB;AAC9D,YAAM,aAAAA,SAAM,IAAI;AAChB,SAAO,UAAM,4BAAU,QAAQ,WAAW,UAAU,EAAE,IAAI,CAAC;AAC/D;",
4
+ "sourcesContent": ["import which from \"which\"\n\nimport { execAsync } from \"./execAsync\"\n\nexport type UnzipOptions = {\n /**\n * 要解压的文件\n */\n input: string\n /**\n * 解压到的目标文件夹位置\n */\n output: string\n /**\n * 压缩文件时的工作目录\n */\n cwd?: string\n}\n\n/**\n * 使用 7z 命令解压文件\n * - 如果没有安装 7z,请先安装 7z 后再执行\n * - 下载地址:https://www.7-zip.org/download.html\n * - 如果已经安装,请按照以下步骤将 7z 添加到环境变量中\n * 1. 设置 → 系统 → 右侧系统信息 → 高级系统设置 → 环境变量\n * 2. 在系统变量中找到并选中 Path,点击编辑\n * 3. 点击新建,输入 7z 的安装路径(默认是 C:\\Program Files\\7-Zip),点击确定\n * 4. 重启终端,输入 7z,如果出现 7z 的版本信息,则安装成功\n * 5. 如果没有出现版本信息,请重启电脑,或者检查 7z 的安装路径是否正确\n */\nexport async function unzip({ input, output, cwd }: UnzipOptions) {\n await which(\"7z\")\n return await execAsync(`7z x ${input} -o${output}`, { cwd })\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAAkB;AAElB,uBAA0B;AA4B1B,eAAsB,MAAM,EAAE,OAAO,QAAQ,IAAI,GAAiB;AAC9D,YAAM,aAAAA,SAAM,IAAI;AAChB,SAAO,UAAM,4BAAU,QAAQ,WAAW,UAAU,EAAE,IAAI,CAAC;AAC/D;",
6
6
  "names": ["which"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/utils/zip.ts"],
4
- "sourcesContent": ["import { cpus } from \"os\"\nimport which from \"which\"\nimport { execAsync } from \"./execAsync\"\n\nexport type ZipOptions = {\n /**\n * 要压缩的文件\n */\n input: string | string[]\n /**\n * 压缩到的目标位置,文件名的后缀就是压缩格式,例如:.zip、.7z\n */\n output: string\n /**\n * 线程数\n */\n thread?: number | \"auto\" | \"max\"\n /**\n * 压缩等级,0-9\n */\n level?: number\n /**\n * 是否加密\n */\n password?: string\n /**\n * 压缩文件时的工作目录\n */\n cwd?: string\n}\n\n/**\n * 使用 7z 命令压缩文件\n * - 如果没有安装 7z,请先安装 7z 后再执行\n * - 下载地址:https://www.7-zip.org/download.html\n * - 如果已经安装,请按照以下步骤将 7z 添加到环境变量中\n * 1. 设置 → 系统 → 右侧系统信息 → 高级系统设置 → 环境变量\n * 2. 在系统变量中找到并选中 Path,点击编辑\n * 3. 点击新建,输入 7z 的安装路径(默认是 C:\\Program Files\\7-Zip),点击确定\n * 4. 重启终端,输入 7z,如果出现 7z 的版本信息,则安装成功\n * 5. 如果没有出现版本信息,请重启电脑,或者检查 7z 的安装路径是否正确\n */\nexport async function zip({ input, output, thread = \"auto\", level, password, cwd }: ZipOptions) {\n await which(\"7z\")\n input = Array.isArray(input) ? input.join(\" \") : input\n if (thread === \"max\") thread = cpus().length\n return await execAsync(\n `7z a ${output} ${input} -mmt=${thread === \"auto\" ? \"on\" : thread}${typeof level === \"number\" ? ` -mx=${level}` : \"\"}${password ? ` -p${password}` : \"\"}`,\n { cwd },\n )\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAAqB;AACrB,mBAAkB;AAClB,uBAA0B;AAwC1B,eAAsB,IAAI,EAAE,OAAO,QAAQ,SAAS,QAAQ,OAAO,UAAU,IAAI,GAAe;AAC5F,YAAM,aAAAA,SAAM,IAAI;AAChB,UAAQ,MAAM,QAAQ,KAAK,IAAI,MAAM,KAAK,GAAG,IAAI;AACjD,MAAI,WAAW;AAAO,iBAAS,gBAAK,EAAE;AACtC,SAAO,UAAM;AAAA,IACT,QAAQ,UAAU,cAAc,WAAW,SAAS,OAAO,SAAS,OAAO,UAAU,WAAW,QAAQ,UAAU,KAAK,WAAW,MAAM,aAAa;AAAA,IACrJ,EAAE,IAAI;AAAA,EACV;AACJ;",
4
+ "sourcesContent": ["import { cpus } from \"os\"\nimport which from \"which\"\n\nimport { execAsync } from \"./execAsync\"\n\nexport type ZipOptions = {\n /**\n * 要压缩的文件\n */\n input: string | string[]\n /**\n * 压缩到的目标位置,文件名的后缀就是压缩格式,例如:.zip、.7z\n */\n output: string\n /**\n * 线程数\n */\n thread?: number | \"auto\" | \"max\"\n /**\n * 压缩等级,0-9\n */\n level?: number\n /**\n * 是否加密\n */\n password?: string\n /**\n * 压缩文件时的工作目录\n */\n cwd?: string\n}\n\n/**\n * 使用 7z 命令压缩文件\n * - 如果没有安装 7z,请先安装 7z 后再执行\n * - 下载地址:https://www.7-zip.org/download.html\n * - 如果已经安装,请按照以下步骤将 7z 添加到环境变量中\n * 1. 设置 → 系统 → 右侧系统信息 → 高级系统设置 → 环境变量\n * 2. 在系统变量中找到并选中 Path,点击编辑\n * 3. 点击新建,输入 7z 的安装路径(默认是 C:\\Program Files\\7-Zip),点击确定\n * 4. 重启终端,输入 7z,如果出现 7z 的版本信息,则安装成功\n * 5. 如果没有出现版本信息,请重启电脑,或者检查 7z 的安装路径是否正确\n */\nexport async function zip({ input, output, thread = \"auto\", level, password, cwd }: ZipOptions) {\n await which(\"7z\")\n input = Array.isArray(input) ? input.join(\" \") : input\n if (thread === \"max\") thread = cpus().length\n return await execAsync(\n `7z a ${output} ${input} -mmt=${thread === \"auto\" ? \"on\" : thread}${typeof level === \"number\" ? ` -mx=${level}` : \"\"}${password ? ` -p${password}` : \"\"}`,\n { cwd },\n )\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,gBAAqB;AACrB,mBAAkB;AAElB,uBAA0B;AAwC1B,eAAsB,IAAI,EAAE,OAAO,QAAQ,SAAS,QAAQ,OAAO,UAAU,IAAI,GAAe;AAC5F,YAAM,aAAAA,SAAM,IAAI;AAChB,UAAQ,MAAM,QAAQ,KAAK,IAAI,MAAM,KAAK,GAAG,IAAI;AACjD,MAAI,WAAW;AAAO,iBAAS,gBAAK,EAAE;AACtC,SAAO,UAAM;AAAA,IACT,QAAQ,UAAU,cAAc,WAAW,SAAS,OAAO,SAAS,OAAO,UAAU,WAAW,QAAQ,UAAU,KAAK,WAAW,MAAM,aAAa;AAAA,IACrJ,EAAE,IAAI;AAAA,EACV;AACJ;",
6
6
  "names": ["which"]
7
7
  }
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":["export * 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"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA"}
1
+ {"version":3,"names":[],"sources":["../../src/index.ts"],"sourcesContent":["export * 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"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA"}
@@ -1 +1 @@
1
- {"version":3,"names":["exec","iconv","execAsync","command","options","decode","rest","Promise","resolve","reject","error","stdout","stderr","Buffer","encoding"],"sources":["../../../src/utils/execAsync.ts"],"sourcesContent":["import { exec, ExecOptions } 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"],"mappings":"AAAA,SAASA,IAAI,QAAqB,eAAe;AAEjD,OAAOC,KAAK,MAAmB,YAAY;AAmB3C,OAAO,eAAeC,SAASA,CAACC,OAAe,EAAEC,OAAa,EAAE;EAC5D,MAAMC,MAAM,GAAGD,OAAO,EAAEC,MAAwC;EAChE,IAAI,OAAOD,OAAO,KAAK,QAAQ,IAAIA,OAAO,KAAK,IAAI,IAAIA,OAAO,CAACC,MAAM,EAAE;IACnE,MAAM;MAAEA,MAAM;MAAE,GAAGC;IAAK,CAAC,GAAGF,OAAyC;IACrEA,OAAO,GAAGE,IAAI;EAClB;EACA,OAAO,MAAM,IAAIC,OAAO,CAAkB,CAACC,OAAO,EAAEC,MAAM,KAAK;IAC3DT,IAAI,CAACG,OAAO,EAAEC,OAAO,EAAE,CAACM,KAAK,EAAEC,MAAM,EAAEC,MAAM,KAAK;MAC9C,IAAIF,KAAK,EAAE,OAAOD,MAAM,CAACC,KAAK,CAAC;MAC/B;MACA,IAAIL,MAAM,IAAIM,MAAM,YAAYE,MAAM,EAAE,OAAOL,OAAO,CAACP,KAAK,CAACI,MAAM,CAACM,MAAM,EAAEN,MAAM,CAACS,QAAQ,EAAET,MAAM,CAACD,OAAO,CAAC,CAAC;MAC7GI,OAAO,CAACG,MAAM,CAAC;IACnB,CAAC,CAAC;EACN,CAAC,CAAC;AACN"}
1
+ {"version":3,"names":["exec","iconv","execAsync","command","options","decode","rest","Promise","resolve","reject","error","stdout","stderr","Buffer","encoding"],"sources":["../../../src/utils/execAsync.ts"],"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"],"mappings":"AAAA,SAAsBA,IAAI,QAAQ,eAAe;AAEjD,OAAOC,KAAK,MAAmB,YAAY;AAmB3C,OAAO,eAAeC,SAASA,CAACC,OAAe,EAAEC,OAAa,EAAE;EAC5D,MAAMC,MAAM,GAAGD,OAAO,EAAEC,MAAwC;EAChE,IAAI,OAAOD,OAAO,KAAK,QAAQ,IAAIA,OAAO,KAAK,IAAI,IAAIA,OAAO,CAACC,MAAM,EAAE;IACnE,MAAM;MAAEA,MAAM;MAAE,GAAGC;IAAK,CAAC,GAAGF,OAAyC;IACrEA,OAAO,GAAGE,IAAI;EAClB;EACA,OAAO,MAAM,IAAIC,OAAO,CAAkB,CAACC,OAAO,EAAEC,MAAM,KAAK;IAC3DT,IAAI,CAACG,OAAO,EAAEC,OAAO,EAAE,CAACM,KAAK,EAAEC,MAAM,EAAEC,MAAM,KAAK;MAC9C,IAAIF,KAAK,EAAE,OAAOD,MAAM,CAACC,KAAK,CAAC;MAC/B;MACA,IAAIL,MAAM,IAAIM,MAAM,YAAYE,MAAM,EAAE,OAAOL,OAAO,CAACP,KAAK,CAACI,MAAM,CAACM,MAAM,EAAEN,MAAM,CAACS,QAAQ,EAAET,MAAM,CAACD,OAAO,CAAC,CAAC;MAC7GI,OAAO,CAACG,MAAM,CAAC;IACnB,CAAC,CAAC;EACN,CAAC,CAAC;AACN"}
@@ -1,5 +1,5 @@
1
1
  /// <reference types="node" />
2
- import { SpawnOptions, SpawnOptionsWithoutStdio, SpawnOptionsWithStdioTuple, StdioNull, StdioPipe } from "child_process";
2
+ import { SpawnOptions, SpawnOptionsWithStdioTuple, SpawnOptionsWithoutStdio, StdioNull, StdioPipe } from "child_process";
3
3
  export declare function spawnAsync(command: string, options?: SpawnOptionsWithoutStdio): Promise<void>;
4
4
  export declare function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>): Promise<void>;
5
5
  export declare function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"names":["spawn","spawnAsync","command","args","options","Promise","resolve","reject","child","on","code","Error"],"sources":["../../../src/utils/spawnAsync.ts"],"sourcesContent":["import { spawn, SpawnOptions, SpawnOptionsWithoutStdio, SpawnOptionsWithStdioTuple, StdioNull, StdioPipe } from \"child_process\"\n\nexport function spawnAsync(command: string, options?: SpawnOptionsWithoutStdio): Promise<void>\nexport function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>): Promise<void>\nexport function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>): Promise<void>\nexport function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>): Promise<void>\nexport function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>): Promise<void>\nexport function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>): Promise<void>\nexport function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>): Promise<void>\nexport function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>): Promise<void>\nexport function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>): Promise<void>\nexport function spawnAsync(command: string, options: SpawnOptions): Promise<void>\nexport function spawnAsync(command: string, args?: readonly string[], options?: SpawnOptionsWithoutStdio): Promise<void>\nexport function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>): Promise<void>\nexport function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>): Promise<void>\nexport function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>): Promise<void>\nexport function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>): Promise<void>\nexport function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>): Promise<void>\nexport function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>): Promise<void>\nexport function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>): Promise<void>\nexport function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>): Promise<void>\nexport function spawnAsync(command: string, args: readonly string[], options: SpawnOptions): Promise<void>\nexport async function spawnAsync(command: string, args?: any, options?: any) {\n await new Promise<void>((resolve, reject) => {\n const child = spawn(command, args, options)\n child.on(\"exit\", code => {\n if (code !== 0) {\n reject(new Error(`\"${command}\" Command failed with code ${code}`))\n return\n }\n resolve()\n })\n })\n}\n"],"mappings":"AAAA,SAASA,KAAK,QAAkG,eAAe;AAsB/H,OAAO,eAAeC,UAAUA,CAACC,OAAe,EAAEC,IAAU,EAAEC,OAAa,EAAE;EACzE,MAAM,IAAIC,OAAO,CAAO,CAACC,OAAO,EAAEC,MAAM,KAAK;IACzC,MAAMC,KAAK,GAAGR,KAAK,CAACE,OAAO,EAAEC,IAAI,EAAEC,OAAO,CAAC;IAC3CI,KAAK,CAACC,EAAE,CAAC,MAAM,EAAEC,IAAI,IAAI;MACrB,IAAIA,IAAI,KAAK,CAAC,EAAE;QACZH,MAAM,CAAC,IAAII,KAAK,CAAE,IAAGT,OAAQ,8BAA6BQ,IAAK,EAAC,CAAC,CAAC;QAClE;MACJ;MACAJ,OAAO,CAAC,CAAC;IACb,CAAC,CAAC;EACN,CAAC,CAAC;AACN"}
1
+ {"version":3,"names":["spawn","spawnAsync","command","args","options","Promise","resolve","reject","child","on","code","Error"],"sources":["../../../src/utils/spawnAsync.ts"],"sourcesContent":["import { SpawnOptions, SpawnOptionsWithStdioTuple, SpawnOptionsWithoutStdio, StdioNull, StdioPipe, spawn } from \"child_process\"\n\nexport function spawnAsync(command: string, options?: SpawnOptionsWithoutStdio): Promise<void>\nexport function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>): Promise<void>\nexport function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>): Promise<void>\nexport function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>): Promise<void>\nexport function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>): Promise<void>\nexport function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>): Promise<void>\nexport function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>): Promise<void>\nexport function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>): Promise<void>\nexport function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>): Promise<void>\nexport function spawnAsync(command: string, options: SpawnOptions): Promise<void>\nexport function spawnAsync(command: string, args?: readonly string[], options?: SpawnOptionsWithoutStdio): Promise<void>\nexport function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>): Promise<void>\nexport function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioNull>): Promise<void>\nexport function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioPipe>): Promise<void>\nexport function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioPipe>): Promise<void>\nexport function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioPipe, StdioNull, StdioNull>): Promise<void>\nexport function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioNull, StdioPipe, StdioNull>): Promise<void>\nexport function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioPipe>): Promise<void>\nexport function spawnAsync(command: string, args: readonly string[], options: SpawnOptionsWithStdioTuple<StdioNull, StdioNull, StdioNull>): Promise<void>\nexport function spawnAsync(command: string, args: readonly string[], options: SpawnOptions): Promise<void>\nexport async function spawnAsync(command: string, args?: any, options?: any) {\n await new Promise<void>((resolve, reject) => {\n const child = spawn(command, args, options)\n child.on(\"exit\", code => {\n if (code !== 0) {\n reject(new Error(`\"${command}\" Command failed with code ${code}`))\n return\n }\n resolve()\n })\n })\n}\n"],"mappings":"AAAA,SAAmGA,KAAK,QAAQ,eAAe;AAsB/H,OAAO,eAAeC,UAAUA,CAACC,OAAe,EAAEC,IAAU,EAAEC,OAAa,EAAE;EACzE,MAAM,IAAIC,OAAO,CAAO,CAACC,OAAO,EAAEC,MAAM,KAAK;IACzC,MAAMC,KAAK,GAAGR,KAAK,CAACE,OAAO,EAAEC,IAAI,EAAEC,OAAO,CAAC;IAC3CI,KAAK,CAACC,EAAE,CAAC,MAAM,EAAEC,IAAI,IAAI;MACrB,IAAIA,IAAI,KAAK,CAAC,EAAE;QACZH,MAAM,CAAC,IAAII,KAAK,CAAE,IAAGT,OAAQ,8BAA6BQ,IAAK,EAAC,CAAC,CAAC;QAClE;MACJ;MACAJ,OAAO,CAAC,CAAC;IACb,CAAC,CAAC;EACN,CAAC,CAAC;AACN"}
@@ -1 +1 @@
1
- {"version":3,"names":["which","execAsync","unzip","input","output","cwd"],"sources":["../../../src/utils/unzip.ts"],"sourcesContent":["import which from \"which\"\nimport { execAsync } from \"./execAsync\"\n\nexport type UnzipOptions = {\n /**\n * 要解压的文件\n */\n input: string\n /**\n * 解压到的目标文件夹位置\n */\n output: string\n /**\n * 压缩文件时的工作目录\n */\n cwd?: string\n}\n\n/**\n * 使用 7z 命令解压文件\n * - 如果没有安装 7z,请先安装 7z 后再执行\n * - 下载地址:https://www.7-zip.org/download.html\n * - 如果已经安装,请按照以下步骤将 7z 添加到环境变量中\n * 1. 设置 → 系统 → 右侧系统信息 → 高级系统设置 → 环境变量\n * 2. 在系统变量中找到并选中 Path,点击编辑\n * 3. 点击新建,输入 7z 的安装路径(默认是 C:\\Program Files\\7-Zip),点击确定\n * 4. 重启终端,输入 7z,如果出现 7z 的版本信息,则安装成功\n * 5. 如果没有出现版本信息,请重启电脑,或者检查 7z 的安装路径是否正确\n */\nexport async function unzip({ input, output, cwd }: UnzipOptions) {\n await which(\"7z\")\n return await execAsync(`7z x ${input} -o${output}`, { cwd })\n}\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,SAAS;AAiBlB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,KAAKA,CAAC;EAAEC,KAAK;EAAEC,MAAM;EAAEC;AAAkB,CAAC,EAAE;EAC9D,MAAML,KAAK,CAAC,IAAI,CAAC;EACjB,OAAO,MAAMC,SAAS,CAAE,QAAOE,KAAM,MAAKC,MAAO,EAAC,EAAE;IAAEC;EAAI,CAAC,CAAC;AAChE"}
1
+ {"version":3,"names":["which","execAsync","unzip","input","output","cwd"],"sources":["../../../src/utils/unzip.ts"],"sourcesContent":["import which from \"which\"\n\nimport { execAsync } from \"./execAsync\"\n\nexport type UnzipOptions = {\n /**\n * 要解压的文件\n */\n input: string\n /**\n * 解压到的目标文件夹位置\n */\n output: string\n /**\n * 压缩文件时的工作目录\n */\n cwd?: string\n}\n\n/**\n * 使用 7z 命令解压文件\n * - 如果没有安装 7z,请先安装 7z 后再执行\n * - 下载地址:https://www.7-zip.org/download.html\n * - 如果已经安装,请按照以下步骤将 7z 添加到环境变量中\n * 1. 设置 → 系统 → 右侧系统信息 → 高级系统设置 → 环境变量\n * 2. 在系统变量中找到并选中 Path,点击编辑\n * 3. 点击新建,输入 7z 的安装路径(默认是 C:\\Program Files\\7-Zip),点击确定\n * 4. 重启终端,输入 7z,如果出现 7z 的版本信息,则安装成功\n * 5. 如果没有出现版本信息,请重启电脑,或者检查 7z 的安装路径是否正确\n */\nexport async function unzip({ input, output, cwd }: UnzipOptions) {\n await which(\"7z\")\n return await execAsync(`7z x ${input} -o${output}`, { cwd })\n}\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AAEzB,SAASC,SAAS;AAiBlB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,KAAKA,CAAC;EAAEC,KAAK;EAAEC,MAAM;EAAEC;AAAkB,CAAC,EAAE;EAC9D,MAAML,KAAK,CAAC,IAAI,CAAC;EACjB,OAAO,MAAMC,SAAS,CAAE,QAAOE,KAAM,MAAKC,MAAO,EAAC,EAAE;IAAEC;EAAI,CAAC,CAAC;AAChE"}
@@ -1 +1 @@
1
- {"version":3,"names":["cpus","which","execAsync","zip","input","output","thread","level","password","cwd","Array","isArray","join","length"],"sources":["../../../src/utils/zip.ts"],"sourcesContent":["import { cpus } from \"os\"\nimport which from \"which\"\nimport { execAsync } from \"./execAsync\"\n\nexport type ZipOptions = {\n /**\n * 要压缩的文件\n */\n input: string | string[]\n /**\n * 压缩到的目标位置,文件名的后缀就是压缩格式,例如:.zip、.7z\n */\n output: string\n /**\n * 线程数\n */\n thread?: number | \"auto\" | \"max\"\n /**\n * 压缩等级,0-9\n */\n level?: number\n /**\n * 是否加密\n */\n password?: string\n /**\n * 压缩文件时的工作目录\n */\n cwd?: string\n}\n\n/**\n * 使用 7z 命令压缩文件\n * - 如果没有安装 7z,请先安装 7z 后再执行\n * - 下载地址:https://www.7-zip.org/download.html\n * - 如果已经安装,请按照以下步骤将 7z 添加到环境变量中\n * 1. 设置 → 系统 → 右侧系统信息 → 高级系统设置 → 环境变量\n * 2. 在系统变量中找到并选中 Path,点击编辑\n * 3. 点击新建,输入 7z 的安装路径(默认是 C:\\Program Files\\7-Zip),点击确定\n * 4. 重启终端,输入 7z,如果出现 7z 的版本信息,则安装成功\n * 5. 如果没有出现版本信息,请重启电脑,或者检查 7z 的安装路径是否正确\n */\nexport async function zip({ input, output, thread = \"auto\", level, password, cwd }: ZipOptions) {\n await which(\"7z\")\n input = Array.isArray(input) ? input.join(\" \") : input\n if (thread === \"max\") thread = cpus().length\n return await execAsync(\n `7z a ${output} ${input} -mmt=${thread === \"auto\" ? \"on\" : thread}${typeof level === \"number\" ? ` -mx=${level}` : \"\"}${password ? ` -p${password}` : \"\"}`,\n { cwd },\n )\n}\n"],"mappings":"AAAA,SAASA,IAAI,QAAQ,IAAI;AACzB,OAAOC,KAAK,MAAM,OAAO;AACzB,SAASC,SAAS;AA6BlB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,GAAGA,CAAC;EAAEC,KAAK;EAAEC,MAAM;EAAEC,MAAM,GAAG,MAAM;EAAEC,KAAK;EAAEC,QAAQ;EAAEC;AAAgB,CAAC,EAAE;EAC5F,MAAMR,KAAK,CAAC,IAAI,CAAC;EACjBG,KAAK,GAAGM,KAAK,CAACC,OAAO,CAACP,KAAK,CAAC,GAAGA,KAAK,CAACQ,IAAI,CAAC,GAAG,CAAC,GAAGR,KAAK;EACtD,IAAIE,MAAM,KAAK,KAAK,EAAEA,MAAM,GAAGN,IAAI,CAAC,CAAC,CAACa,MAAM;EAC5C,OAAO,MAAMX,SAAS,CACjB,QAAOG,MAAO,IAAGD,KAAM,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,EACzJ;IAAEC;EAAI,CACV,CAAC;AACL"}
1
+ {"version":3,"names":["cpus","which","execAsync","zip","input","output","thread","level","password","cwd","Array","isArray","join","length"],"sources":["../../../src/utils/zip.ts"],"sourcesContent":["import { cpus } from \"os\"\nimport which from \"which\"\n\nimport { execAsync } from \"./execAsync\"\n\nexport type ZipOptions = {\n /**\n * 要压缩的文件\n */\n input: string | string[]\n /**\n * 压缩到的目标位置,文件名的后缀就是压缩格式,例如:.zip、.7z\n */\n output: string\n /**\n * 线程数\n */\n thread?: number | \"auto\" | \"max\"\n /**\n * 压缩等级,0-9\n */\n level?: number\n /**\n * 是否加密\n */\n password?: string\n /**\n * 压缩文件时的工作目录\n */\n cwd?: string\n}\n\n/**\n * 使用 7z 命令压缩文件\n * - 如果没有安装 7z,请先安装 7z 后再执行\n * - 下载地址:https://www.7-zip.org/download.html\n * - 如果已经安装,请按照以下步骤将 7z 添加到环境变量中\n * 1. 设置 → 系统 → 右侧系统信息 → 高级系统设置 → 环境变量\n * 2. 在系统变量中找到并选中 Path,点击编辑\n * 3. 点击新建,输入 7z 的安装路径(默认是 C:\\Program Files\\7-Zip),点击确定\n * 4. 重启终端,输入 7z,如果出现 7z 的版本信息,则安装成功\n * 5. 如果没有出现版本信息,请重启电脑,或者检查 7z 的安装路径是否正确\n */\nexport async function zip({ input, output, thread = \"auto\", level, password, cwd }: ZipOptions) {\n await which(\"7z\")\n input = Array.isArray(input) ? input.join(\" \") : input\n if (thread === \"max\") thread = cpus().length\n return await execAsync(\n `7z a ${output} ${input} -mmt=${thread === \"auto\" ? \"on\" : thread}${typeof level === \"number\" ? ` -mx=${level}` : \"\"}${password ? ` -p${password}` : \"\"}`,\n { cwd },\n )\n}\n"],"mappings":"AAAA,SAASA,IAAI,QAAQ,IAAI;AACzB,OAAOC,KAAK,MAAM,OAAO;AAEzB,SAASC,SAAS;AA6BlB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,GAAGA,CAAC;EAAEC,KAAK;EAAEC,MAAM;EAAEC,MAAM,GAAG,MAAM;EAAEC,KAAK;EAAEC,QAAQ;EAAEC;AAAgB,CAAC,EAAE;EAC5F,MAAMR,KAAK,CAAC,IAAI,CAAC;EACjBG,KAAK,GAAGM,KAAK,CAACC,OAAO,CAACP,KAAK,CAAC,GAAGA,KAAK,CAACQ,IAAI,CAAC,GAAG,CAAC,GAAGR,KAAK;EACtD,IAAIE,MAAM,KAAK,KAAK,EAAEA,MAAM,GAAGN,IAAI,CAAC,CAAC,CAACa,MAAM;EAC5C,OAAO,MAAMX,SAAS,CACjB,QAAOG,MAAO,IAAGD,KAAM,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,EACzJ;IAAEC;EAAI,CACV,CAAC;AACL"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "soda-nodejs",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "description": "",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
package/src/index.ts CHANGED
@@ -1,7 +1,7 @@
1
- export * from "@utils/copy"
2
- export * from "@utils/execAsync"
3
- export * from "@utils/saveFile"
4
- export * from "@utils/saveResponse"
5
- export * from "@utils/spawnAsync"
6
- export * from "@utils/unzip"
7
- export * from "@utils/zip"
1
+ export * from "@/utils/copy"
2
+ export * from "@/utils/execAsync"
3
+ export * from "@/utils/saveFile"
4
+ export * from "@/utils/saveResponse"
5
+ export * from "@/utils/spawnAsync"
6
+ export * from "@/utils/unzip"
7
+ export * from "@/utils/zip"
@@ -1,4 +1,4 @@
1
- import { exec, ExecOptions } from "child_process"
1
+ import { ExecOptions, exec } from "child_process"
2
2
  import { ObjectEncodingOptions } from "fs"
3
3
  import iconv, { Options } from "iconv-lite"
4
4
 
@@ -1,4 +1,4 @@
1
- import { spawn, SpawnOptions, SpawnOptionsWithoutStdio, SpawnOptionsWithStdioTuple, StdioNull, StdioPipe } from "child_process"
1
+ import { SpawnOptions, SpawnOptionsWithStdioTuple, SpawnOptionsWithoutStdio, StdioNull, StdioPipe, spawn } from "child_process"
2
2
 
3
3
  export function spawnAsync(command: string, options?: SpawnOptionsWithoutStdio): Promise<void>
4
4
  export function spawnAsync(command: string, options: SpawnOptionsWithStdioTuple<StdioPipe, StdioPipe, StdioPipe>): Promise<void>
@@ -1,4 +1,5 @@
1
1
  import which from "which"
2
+
2
3
  import { execAsync } from "./execAsync"
3
4
 
4
5
  export type UnzipOptions = {
package/src/utils/zip.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { cpus } from "os"
2
2
  import which from "which"
3
+
3
4
  import { execAsync } from "./execAsync"
4
5
 
5
6
  export type ZipOptions = {