Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chardet is locking main-thread in browser (electron) context without errors? #47

Open
thrnd opened this issue Apr 5, 2021 · 3 comments

Comments

@thrnd
Copy link

thrnd commented Apr 5, 2021

Hello there!

I am trying to use chardet while parsing big (20-30k+ rows) csv files. When i am calling chardet.detect() it returns result for first 10-14 elements and then main thread just dies and nothing happenning. Same thing in web-worker context (still inside electron).

My code (it is working in electron app in browser main thread context):

const chardet = require("chardet");

hugeArrayOfRowsParsedFromCSVFile.forEach((row, index) => {
    if (index > 100 && index < 200) {
        console.log( chardet.detect( row[0] ) ); //  row[0] is always a String
    }
}

Can the problem be in bad implemented electron's API (require)? I din't yet try chardet in non-electron browser context.

@thrnd
Copy link
Author

thrnd commented Apr 5, 2021

Ok... i've found out that value to detect was not always a String - sometimes it is a Number, sometimes undefined... But why there is no error message then? I've got once an error something like: "Argument must be a ArrayBuffer or a String"

@runk
Copy link
Owner

runk commented Mar 24, 2022

Sorry for the 11 months delay 😬

Would you be able to share a test data for this case?

@andrew-pledge-io
Copy link

andrew-pledge-io commented Sep 27, 2023

I've run into this as well. It's easy to replicate in the Node repl:

$ node
const chardet = require('chardet');
chardet.detect(123);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants