Skip to content

Commit 3ac1368

Browse files
committed
Added more specific types for the encoding
1 parent 93f103e commit 3ac1368

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/config/languageObject.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,8 @@ module.exports = [
388388
utfFrequency: { low: 0.003194, high: 0.003468 },
389389
isoFrequency: { low: 0.002091, high: 0.002303 }
390390
},
391+
// The following languages don't seem to have their own encoding
392+
// Subtitle files in these languages seem to almost exclusively use UTF encoding.
391393
{
392394
name: "bengali",
393395
count: 0,

src/index-node.d.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
export interface FileInfo {
2-
encoding: null | string,
3-
language: null | string,
2+
encoding: null | 'UTF-EBCDIC' | 'GB-18030' | 'GB18030' | 'UTF-32LE' | 'UTF-32BE' | 'UTF-8' | 'UTF-7' | 'UTF-1' | 'SCSU' | 'BOCU-1' | 'UTF-16BE' | 'UTF-16LE' | 'latin1' | 'ISO-8859-1' | 'CP1250' | 'CP1251' | 'CP1252' | 'CP1253' | 'CP1254' | 'CP1255' | 'CP1256' | 'CP1257' | 'BIG5' | 'Shift-JIS' | 'EUC-KR' | 'TIS-620';
3+
language: null | string;
44
confidence: {
5-
encoding: null | string,
6-
language: null | string,
5+
encoding: null | number;
6+
language: null | number;
77
},
88
}
99

10-
declare function DetectFileEncodingAndLanguage(file: File): Promise<FileInfo>
10+
declare function DetectFileEncodingAndLanguage(file: File): Promise<FileInfo>;
1111
export default DetectFileEncodingAndLanguage;

0 commit comments

Comments
 (0)