@king-3/file-kit 1.1.0 → 1.3.0
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/cli.js +14 -14
- package/package.json +3 -3
package/dist/cli.js
CHANGED
|
@@ -225,7 +225,7 @@ async function base64ToFile(archiveData, outputDir = ".") {
|
|
|
225
225
|
//#endregion
|
|
226
226
|
//#region src/config/defaults.ts
|
|
227
227
|
const CLI_NAME = "File Kit";
|
|
228
|
-
const CLI_VERSION = "1.
|
|
228
|
+
const CLI_VERSION = "1.3.0";
|
|
229
229
|
const CLI_ALIAS = "fkt";
|
|
230
230
|
/**
|
|
231
231
|
* 默认配置
|
|
@@ -424,7 +424,7 @@ async function loadArchive(filePath, type) {
|
|
|
424
424
|
var base64_default = defineCommand({
|
|
425
425
|
meta: {
|
|
426
426
|
name: "base64",
|
|
427
|
-
description: "将文件转换为 Base64 JSON"
|
|
427
|
+
description: "将文件转换为 Base64 JSON 文本"
|
|
428
428
|
},
|
|
429
429
|
args: {
|
|
430
430
|
input: {
|
|
@@ -446,7 +446,7 @@ var base64_default = defineCommand({
|
|
|
446
446
|
message: "请输入文件路径",
|
|
447
447
|
placeholder: "file.txt"
|
|
448
448
|
});
|
|
449
|
-
const outputPath = buildOutputPath(inputPath, await ctx.getOutput(typedArgs.output, { defaultDir: path.dirname(inputPath) }), "base64.
|
|
449
|
+
const outputPath = buildOutputPath(inputPath, await ctx.getOutput(typedArgs.output, { defaultDir: path.dirname(inputPath) }), "base64.txt");
|
|
450
450
|
const loading$1 = ctx.loading("正在转换");
|
|
451
451
|
const archiveData = await fileToBase64(inputPath, outputPath);
|
|
452
452
|
loading$1.close(`文件已保存到: ${cyan(outputPath)}, 共计 ${bold.gray((archiveData.file.size / 1024).toFixed(2))} KB`);
|
|
@@ -550,12 +550,12 @@ async function decrypt(archiveData, outputDir = ".", options) {
|
|
|
550
550
|
var decrypt_default = defineCommand({
|
|
551
551
|
meta: {
|
|
552
552
|
name: "decrypt",
|
|
553
|
-
description: "解密文件"
|
|
553
|
+
description: "从 CRYPTO JSON 解密文件"
|
|
554
554
|
},
|
|
555
555
|
args: {
|
|
556
556
|
input: {
|
|
557
557
|
type: "positional",
|
|
558
|
-
description: "加密文件 (*.crypto.
|
|
558
|
+
description: "加密文件 (*.crypto.txt)",
|
|
559
559
|
required: true
|
|
560
560
|
},
|
|
561
561
|
output: {
|
|
@@ -576,8 +576,8 @@ var decrypt_default = defineCommand({
|
|
|
576
576
|
tryCatch(async () => {
|
|
577
577
|
const inputPath = await ctx.getInput(typedArgs.input, {
|
|
578
578
|
message: "请输入文件路径",
|
|
579
|
-
placeholder: "*.crypto.
|
|
580
|
-
validateExtension: ".crypto.
|
|
579
|
+
placeholder: "*.crypto.txt",
|
|
580
|
+
validateExtension: ".crypto.txt"
|
|
581
581
|
});
|
|
582
582
|
const outputDir = await ctx.getOutput(typedArgs.output, { defaultDir: path.dirname(inputPath) });
|
|
583
583
|
const password$2 = await getPassword(typedArgs.password);
|
|
@@ -594,7 +594,7 @@ var decrypt_default = defineCommand({
|
|
|
594
594
|
var encrypt_default = defineCommand({
|
|
595
595
|
meta: {
|
|
596
596
|
name: "encrypt",
|
|
597
|
-
description: "
|
|
597
|
+
description: "将文件加密为 CRYPTO JSON 文本"
|
|
598
598
|
},
|
|
599
599
|
args: {
|
|
600
600
|
input: {
|
|
@@ -626,7 +626,7 @@ var encrypt_default = defineCommand({
|
|
|
626
626
|
const password$2 = await getPassword(typedArgs.password);
|
|
627
627
|
console.log(gray("│"));
|
|
628
628
|
logger.warn(yellow("请妥善保管密码,丢失后无法恢复文件!"));
|
|
629
|
-
const outputPath = buildOutputPath(inputPath, outputDir, "crypto.
|
|
629
|
+
const outputPath = buildOutputPath(inputPath, outputDir, "crypto.txt");
|
|
630
630
|
const loading$1 = ctx.loading("正在加密");
|
|
631
631
|
const archiveData = await encrypt(inputPath, outputPath, { password: password$2 });
|
|
632
632
|
loading$1.close(`文件已加密到: ${cyan(outputPath)}, 共计 ${bold.gray((archiveData.file.size / 1024).toFixed(2))} KB`);
|
|
@@ -645,7 +645,7 @@ var restore_default = defineCommand({
|
|
|
645
645
|
args: {
|
|
646
646
|
input: {
|
|
647
647
|
type: "positional",
|
|
648
|
-
description: "Base64 文件 (*.base64.
|
|
648
|
+
description: "Base64 文件 (*.base64.txt)"
|
|
649
649
|
},
|
|
650
650
|
output: {
|
|
651
651
|
type: "string",
|
|
@@ -660,8 +660,8 @@ var restore_default = defineCommand({
|
|
|
660
660
|
tryCatch(async () => {
|
|
661
661
|
const inputPath = await ctx.getInput(typedArgs.input, {
|
|
662
662
|
message: "请输入文件路径",
|
|
663
|
-
placeholder: "*.base64.
|
|
664
|
-
validateExtension: "base64.
|
|
663
|
+
placeholder: "*.base64.txt",
|
|
664
|
+
validateExtension: "base64.txt"
|
|
665
665
|
});
|
|
666
666
|
const outputDir = await ctx.getOutput(typedArgs.output, { defaultDir: path.dirname(inputPath) });
|
|
667
667
|
const loading$1 = ctx.loading("正在恢复");
|
|
@@ -1012,10 +1012,10 @@ function showHelp() {
|
|
|
1012
1012
|
console.log(` ${ansis.green("decrypt")}${ansis.dim(" 解密文件")}\n`);
|
|
1013
1013
|
console.log(ansis.bold("示例:"));
|
|
1014
1014
|
console.log(` ${ansis.yellow(CLI_ALIAS)} ${ansis.cyan("base64")} ${ansis.green("file.txt")} ${ansis.dim("转换文件为 Base64")}`);
|
|
1015
|
-
console.log(` ${ansis.yellow(CLI_ALIAS)} ${ansis.cyan("restore")} ${ansis.green("file.
|
|
1015
|
+
console.log(` ${ansis.yellow(CLI_ALIAS)} ${ansis.cyan("restore")} ${ansis.green("file.base64.txt")} ${ansis.dim("还原 Base64 文件")}`);
|
|
1016
1016
|
console.log(` ${ansis.yellow(CLI_ALIAS)} ${ansis.cyan("v2a")} ${ansis.green("video.mp4")} ${ansis.blue("-f mp3")} ${ansis.dim("提取视频音频为 MP3")}`);
|
|
1017
1017
|
console.log(` ${ansis.yellow(CLI_ALIAS)} ${ansis.cyan("encrypt")} ${ansis.green("secret.txt")} ${ansis.blue("-p pwd")} ${ansis.dim("加密文件")}`);
|
|
1018
|
-
console.log(` ${ansis.yellow(CLI_ALIAS)} ${ansis.cyan("decrypt")} ${ansis.green("secret.
|
|
1018
|
+
console.log(` ${ansis.yellow(CLI_ALIAS)} ${ansis.cyan("decrypt")} ${ansis.green("secret.crypto.txt")} ${ansis.blue("-p pwd")} ${ansis.dim("解密文件")}`);
|
|
1019
1019
|
console.log(` ${ansis.yellow(CLI_ALIAS)} ${ansis.cyan("-i")} ${ansis.dim("交互式选择功能")}\n`);
|
|
1020
1020
|
}
|
|
1021
1021
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@king-3/file-kit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "多功能文件工具箱(Base64 转换 · 视频转音频 · 加密/解密)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@king-3/eslint-config": "^4.4.0",
|
|
49
49
|
"@king-3/prettier-config": "^3.4.0",
|
|
50
50
|
"@types/node": "^20.19.26",
|
|
51
|
-
"bumpp": "^10.
|
|
51
|
+
"bumpp": "^10.4.1",
|
|
52
52
|
"eslint": "^9.39.1",
|
|
53
53
|
"prettier": "^3.7.4",
|
|
54
54
|
"tsdown": "^0.18.0",
|
|
@@ -66,6 +66,6 @@
|
|
|
66
66
|
"lint": "eslint",
|
|
67
67
|
"lint:fix": "eslint --fix",
|
|
68
68
|
"typecheck": "tsc --noEmit",
|
|
69
|
-
"release": "
|
|
69
|
+
"release": "tsx scripts/release.ts"
|
|
70
70
|
}
|
|
71
71
|
}
|