node-id3
node-id3 copied to clipboard
[feature] Add support for React Native
Hi!
I would like to use this package in my React Native project for reading and writing id3 tags to mp3 files. I have tried to make it working myself, but I can't get it to work. Is there any chance this package could be compatible with React Native?
Thanks in advance!
I think react-native will always fail to execute with node-id3 due to the fs/zlib module import. I'm not sure if there are ways to replace them at compile-time with react-native-fs/react-native-level-fs/react-native-zlib, otherwise I don't see how support can be achieved without creating a new module targeted for react-native
Thank you for your response. I have indeed tried to use react-native-fs and react-native-zlib, all the errors where gone and my RN build was ok, but the raw output of ID3.read() for example was always empty. I've must have missed something.
Anyways, it was just an idea, I think it will be fairly used. Feel free to close this issue.
Not sure what the problem is then, sorry.
As a workaround, you can also pass a buffer to ID3.read() instead of a filepath. Basically, read the file with react-native-fs and get it as buffer yourself, then pass it to ID3.read().
Same for ID3.write() and ID3.update()
I will give it a try, thank you!
I think react-native will always fail to execute with node-id3 due to the fs/zlib module import. I'm not sure if there are ways to replace them at compile-time with react-native-fs/react-native-level-fs/react-native-zlib, otherwise I don't see how support can be achieved without creating a new module targeted for react-native
Some thoughts for the future:
- we should create two APIs on with file operations, one without file operation (which is more less the plan for the next major release)
- we should try to inject
zlibandfsat runtime and two entry points one injecting for node and another one without default injection