File tree Expand file tree Collapse file tree 2 files changed +3
-2
lines changed Expand file tree Collapse file tree 2 files changed +3
-2
lines changed Original file line number Diff line number Diff 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} ;
Original file line number Diff line number Diff 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 = ( ) => {
You can’t perform that action at this time.
0 commit comments