soda-nodejs 0.8.8 → 0.8.9
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/README.md +23 -23
- package/dist/utils/execAsync.d.ts +2 -2
- package/package.json +1 -1
- package/src/utils/execAsync.ts +2 -2
- package/src/utils/isPathLike.ts +5 -5
- package/src/utils/unzip.ts +34 -34
- package/tsconfig.json +15 -15
package/README.md
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
# soda-node
|
|
2
|
-
|
|
3
|
-
[](https://npmjs.com/package/soda-node)
|
|
4
|
-
[](https://npmjs.com/package/soda-node)
|
|
5
|
-
|
|
6
|
-
## Install
|
|
7
|
-
|
|
8
|
-
```bash
|
|
9
|
-
$ pnpm install
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
```bash
|
|
13
|
-
$ npm run dev
|
|
14
|
-
$ npm run build
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
## Options
|
|
18
|
-
|
|
19
|
-
TODO
|
|
20
|
-
|
|
21
|
-
## LICENSE
|
|
22
|
-
|
|
23
|
-
MIT
|
|
1
|
+
# soda-node
|
|
2
|
+
|
|
3
|
+
[](https://npmjs.com/package/soda-node)
|
|
4
|
+
[](https://npmjs.com/package/soda-node)
|
|
5
|
+
|
|
6
|
+
## Install
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
$ pnpm install
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
$ npm run dev
|
|
14
|
+
$ npm run build
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Options
|
|
18
|
+
|
|
19
|
+
TODO
|
|
20
|
+
|
|
21
|
+
## LICENSE
|
|
22
|
+
|
|
23
|
+
MIT
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ExecOptions } from "child_process";
|
|
2
2
|
import { ObjectEncodingOptions } from "fs";
|
|
3
|
-
import {
|
|
3
|
+
import { DecodeOptions } from "iconv-lite";
|
|
4
4
|
export type IconvDecodeOptions = {
|
|
5
5
|
encoding: string;
|
|
6
|
-
options?:
|
|
6
|
+
options?: DecodeOptions;
|
|
7
7
|
};
|
|
8
8
|
export declare function execAsync(command: string): Promise<string>;
|
|
9
9
|
export declare function execAsync(command: string, options: {
|
package/package.json
CHANGED
package/src/utils/execAsync.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { exec, ExecOptions } from "child_process"
|
|
2
2
|
import { ObjectEncodingOptions } from "fs"
|
|
3
3
|
|
|
4
|
-
import iconv, {
|
|
4
|
+
import iconv, { DecodeOptions } from "iconv-lite"
|
|
5
5
|
|
|
6
6
|
export type IconvDecodeOptions = {
|
|
7
7
|
encoding: string
|
|
8
|
-
options?:
|
|
8
|
+
options?: DecodeOptions
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export async function execAsync(command: string): Promise<string>
|
package/src/utils/isPathLike.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PathLike } from "fs"
|
|
2
|
-
|
|
3
|
-
export function isPathLike(path: unknown): path is PathLike {
|
|
4
|
-
return typeof path === "string" || path instanceof Buffer || path instanceof URL
|
|
5
|
-
}
|
|
1
|
+
import { PathLike } from "fs"
|
|
2
|
+
|
|
3
|
+
export function isPathLike(path: unknown): path is PathLike {
|
|
4
|
+
return typeof path === "string" || path instanceof Buffer || path instanceof URL
|
|
5
|
+
}
|
package/src/utils/unzip.ts
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import which from "which"
|
|
2
|
-
|
|
3
|
-
import { execAsync } from "./execAsync"
|
|
4
|
-
|
|
5
|
-
export type UnzipOptions = {
|
|
6
|
-
/**
|
|
7
|
-
* 要解压的文件
|
|
8
|
-
*/
|
|
9
|
-
input: string
|
|
10
|
-
/**
|
|
11
|
-
* 解压到的目标文件夹位置
|
|
12
|
-
*/
|
|
13
|
-
output: string
|
|
14
|
-
/**
|
|
15
|
-
* 压缩文件时的工作目录
|
|
16
|
-
*/
|
|
17
|
-
cwd?: string
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* 使用 7z 命令解压文件
|
|
22
|
-
* - 如果没有安装 7z,请先安装 7z 后再执行
|
|
23
|
-
* - 下载地址:https://www.7-zip.org/download.html
|
|
24
|
-
* - 如果已经安装,请按照以下步骤将 7z 添加到环境变量中
|
|
25
|
-
* 1. 设置 → 系统 → 右侧系统信息 → 高级系统设置 → 环境变量
|
|
26
|
-
* 2. 在系统变量中找到并选中 Path,点击编辑
|
|
27
|
-
* 3. 点击新建,输入 7z 的安装路径(默认是 C:\Program Files\7-Zip),点击确定
|
|
28
|
-
* 4. 重启终端,输入 7z,如果出现 7z 的版本信息,则安装成功
|
|
29
|
-
* 5. 如果没有出现版本信息,请重启电脑,或者检查 7z 的安装路径是否正确
|
|
30
|
-
*/
|
|
31
|
-
export async function unzip({ input, output, cwd }: UnzipOptions) {
|
|
32
|
-
await which("7z")
|
|
33
|
-
return await execAsync(`7z x ${input} -o${output}`, { cwd })
|
|
34
|
-
}
|
|
1
|
+
import which from "which"
|
|
2
|
+
|
|
3
|
+
import { execAsync } from "./execAsync"
|
|
4
|
+
|
|
5
|
+
export type UnzipOptions = {
|
|
6
|
+
/**
|
|
7
|
+
* 要解压的文件
|
|
8
|
+
*/
|
|
9
|
+
input: string
|
|
10
|
+
/**
|
|
11
|
+
* 解压到的目标文件夹位置
|
|
12
|
+
*/
|
|
13
|
+
output: string
|
|
14
|
+
/**
|
|
15
|
+
* 压缩文件时的工作目录
|
|
16
|
+
*/
|
|
17
|
+
cwd?: string
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* 使用 7z 命令解压文件
|
|
22
|
+
* - 如果没有安装 7z,请先安装 7z 后再执行
|
|
23
|
+
* - 下载地址:https://www.7-zip.org/download.html
|
|
24
|
+
* - 如果已经安装,请按照以下步骤将 7z 添加到环境变量中
|
|
25
|
+
* 1. 设置 → 系统 → 右侧系统信息 → 高级系统设置 → 环境变量
|
|
26
|
+
* 2. 在系统变量中找到并选中 Path,点击编辑
|
|
27
|
+
* 3. 点击新建,输入 7z 的安装路径(默认是 C:\Program Files\7-Zip),点击确定
|
|
28
|
+
* 4. 重启终端,输入 7z,如果出现 7z 的版本信息,则安装成功
|
|
29
|
+
* 5. 如果没有出现版本信息,请重启电脑,或者检查 7z 的安装路径是否正确
|
|
30
|
+
*/
|
|
31
|
+
export async function unzip({ input, output, cwd }: UnzipOptions) {
|
|
32
|
+
await which("7z")
|
|
33
|
+
return await execAsync(`7z x ${input} -o${output}`, { cwd })
|
|
34
|
+
}
|
package/tsconfig.json
CHANGED
|
@@ -1,15 +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
|
-
}
|
|
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
|
+
}
|