fs.readFileSync is not a function in browser
Closed this issue · 5 comments
Hello. Wanted to use this in a web application but am getting an error about the fs module during:
index.js?a0a5:42 Uncaught TypeError: fs.readFileSync is not a function
at Object.eval (index.js?a0a5:42)
at eval (index.js:131)
at Object../node_modules/fakelish/dist/lib/index.js (app.js:3740)
Line of code in question:
42 | var wordProbability = JSON.parse(zlib.gunzipSync(fs.readFileSync(wordProbabilityPath)).toString("utf-8"));
Seems like a shame to not be able to use this in browser! I was really looking forward to trying it.
Yes, you're right. Currently fakelish
doesn't support Web browsers. The reason is that the probability JSON is large. The JSON is 1.4MB as a text file, but in tar.gz, it's 385 KB.
Because you found your demand, I'll work on it.
@Inventsable
You can find a simple demo here.
https://fakelish.netlify.com/
Thank you!
Thank you for creating the issue.