Skip to content

Commit

Permalink
Merge pull request #562 from runk/fix-chardet-usage
Browse files Browse the repository at this point in the history
Fix chardet usage
  • Loading branch information
martpie authored Dec 29, 2020
2 parents 583b974 + 4ea483b commit 3a45ee6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/ui/lib/utils-m3u.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ const isFile = (path: string) => fs.lstatSync(path).isFile();
export const parse = (filePath: string): string[] => {
try {
const baseDir = path.parse(filePath).dir;
const encoding = chardet.detectFileSync(filePath);
const content = fs.readFileSync(filePath);
const encoding = chardet.detect(content);

if (typeof encoding !== 'string') {
throw new Error(`could not guess the file encoding (${filePath})`);
Expand Down

0 comments on commit 3a45ee6

Please sign in to comment.