BrowserFS is an in-browser filesystem that emulates the Node JS filesystem API and supports storing and retrieving files from various backends.
3.07k
stars
218
forks
source link
Process shim messing up with iconv-lite from express or body-parser #303
Closed
acailly closed 4 years ago
I finally understood a bug I had with
iconv-lite
(https://github.com/ashtuchkin/iconv-lite) when I was trying to browserifyexpress
(https://github.com/expressjs/express) orbody-parser
(https://github.com/expressjs/body-parser) with a configuration that used BrowserFSThis is an issue for my future me and for everyone that fell in the same trap. Feel free to close it.
These libraries use an old version of
iconv-lite
(0.4.24) which load streams or not depending on the snippet contained in this issue: https://github.com/ashtuchkin/iconv-lite/issues/202You can see it loads streams if
process.versions.node
is defined, and it is usually undefined when bundling with browserify or webpack.Except if we use BrowserFS and its shim for
process
, thenprocess.versions.node
become defined and it tries to load streams (and fail).The workaround I found is to add the following line in the first lines of your app:
I haven't tested it extensively so I don't know if it causes more bugs.
If you have a better solution, tell me! :smiley: