Skip to content

Commit

Permalink
2.4.9 unzip fix
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaobaidadada committed Feb 4, 2025
1 parent 3db0154 commit 9553460
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "filecat",
"version": "2.4.8",
"version": "2.4.9",
"description": "filecat 文件管理器",
"author": "xiaobaidadada",
"scripts": {
Expand Down Expand Up @@ -151,7 +151,7 @@
"ts-node": "^10.9.2",
"typedi": "^0.10.0",
"typescript": "^5.6.3",
"unzipper": "^0.12.3",
"unzip-stream": "^0.3.4",
"video.js": "^8.17.2",
"videojs-hotkeys": "^0.2.28",
"webpack": "^5.96.1",
Expand Down
7 changes: 4 additions & 3 deletions src/main/domain/file/file.compress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ import {FileCompressType} from "../../../common/file.pojo";
import {loadWasm} from "../bin/bin";

const fs = require('fs');
const unzipper = require('unzipper');
// const unzipper = require('unzipper'); // 对于流会有损坏的问题
const unzip_stream = require('unzip-stream');
const tar = require('tar');
const zlib = require('zlib');
// const zlib = require('zlib');
const archiver = require('archiver');
const unrar = require("node-unrar-js");

Expand All @@ -17,7 +18,7 @@ export class FileCompress {
let processedSize = 0;
// 创建文件读取流
const readStream = fs.createReadStream(filePath);
const extractStream = unzipper.Extract({path: targetFolder});
const extractStream = unzip_stream.Extract({path: targetFolder});
// 监听读取流的 data 事件来计算进度
readStream.on('data', (chunk) => {
processedSize += chunk.length;
Expand Down
2 changes: 1 addition & 1 deletion src/main/domain/file/file.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ class FileService extends FileCompress {
const pojo = data.context as FileCompressPojo;
const source_file = decodeURIComponent(pojo.source_file);
const tar_dir = decodeURIComponent(pojo.tar_dir ?? "");
const directoryPath = path.dirname(source_file);
const directoryPath = decodeURIComponent(path.dirname(source_file));
const root_path = settingService.getFileRootPath(pojo.token);
const targetFolder = path.join(root_path, directoryPath, tar_dir);
const wss = data.wss as Wss;
Expand Down
2 changes: 1 addition & 1 deletion src/web/project/component/prompts/FileMenu/UnCompress.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export function UnCompress(props) {
const confirm = ()=> {
const extension = StringUtil.getFileExtension(showPrompt.data.filename) ?? "" as string;

const sourceFileName = `${encodeURIComponent(getRouterAfter('file',getRouterPath()))}${showPrompt.data.filename}`;
const sourceFileName = `${getRouterAfter('file',getRouterPath())}${showPrompt.data.filename}`;

const req = new FileCompressPojo();
let format;
Expand Down

0 comments on commit 9553460

Please sign in to comment.