Closed FritzHeiden closed 5 years ago
Yeah, in the browser version we don’t have it because that reader depends on the filesystem module. Why not use the npm package?
I'm writing a library which I use in different environments: node, react native and the browser.
Oh, I see. Yeah, that’s more tricky as the browser version is a compilation of the original code which is targetting node. You can see that here: https://github.com/aadsm/jsmediatags/blob/master/package.json#L72. My recommendation is to use the npm version of this package and do something similar in your build process.
When trying to use the browser version (dist/jsmediatags.js) in a node.js environment it is impossible to use the library.
It does some initialization, where adding the NodeFileReader doesn't seem to work as it just adds an empty object (
{}
) which in turn causes thefindFileReader()
method to fail when trying to read the tags.Obviously this method call doesn't work because at some point
mediaFileReaders[i]
will be{}
.I hope I could make sense of the issue I have. For now I just use a copy of the script, where I changed the
findFileReader()
method to