Skip to content

Commit 4c6dfb6

Browse files
committed
fix: ts
1 parent e78a70a commit 4c6dfb6

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

packages/global/common/file/tools.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ export const formatFileSize = (bytes: number): string => {
1010
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];
1111
};
1212

13-
export const detectFileEncoding = (buffers: Buffer) => {
13+
export const detectFileEncoding = (buffers: string | Buffer) => {
1414
return detect(buffers)?.encoding || 'utf-8';
1515
};

packages/web/common/file/read/rawText.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ export const readFileRawText = (file: File) => {
88
try {
99
const reader = new FileReader();
1010
reader.onload = () => {
11+
//@ts-ignore
1112
const encode = detectFileEncoding(reader.result);
12-
13+
console.log(encode);
1314
// 再次读取文件,这次使用检测到的编码
1415
const reader2 = new FileReader();
1516
reader2.onload = () => {

0 commit comments

Comments
 (0)