bun 多文件上传会有问题

This commit is contained in:
2025-05-11 21:57:54 +08:00
parent cdbebe92d0
commit 4aec2bc231
9 changed files with 510 additions and 691 deletions

View File

@@ -5,7 +5,7 @@
import { chalk } from '@/module/chalk.ts';
import { program, Command } from '../../../program.ts';
import { queryApp } from '../../../query/app-manager/query-app.ts';
import { checkAppDir, installApp, uninstallApp } from '@/module/download/install.ts';
import { checkAppDir, installApp, uninstallApp, fetchLink } from '@/module/download/install.ts';
import { fileIsExist } from '@/uitls/file.ts';
import fs from 'fs';
import { getConfig } from '@/module/get-config.ts';
@@ -156,3 +156,20 @@ const uninstallAppCommand = new Command('uninstall')
appCommand.addCommand(downloadAppCommand);
appCommand.addCommand(uninstallAppCommand);
const link = new Command('link')
.argument('url')
.option('-o --output <output>', '输出目录')
.action(async (url, options) => {
const output = options.output || '';
const { content, filename } = await fetchLink(url, { returnContent: true });
if (output) {
const checkOutput = fileIsExist(output);
if (!checkOutput) {
fs.mkdirSync(output, { recursive: true });
}
}
fs.writeFileSync(path.join(output, filename), content);
});
appCommand.addCommand(link);