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

[feature] Add support for React Native #113

Open
PeeJeeDR opened this issue Oct 22, 2021 · 5 comments
Open

[feature] Add support for React Native #113

PeeJeeDR opened this issue Oct 22, 2021 · 5 comments

Comments

@PeeJeeDR
Copy link

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!

@Zazama
Copy link
Owner

Zazama commented Oct 23, 2021

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

@PeeJeeDR
Copy link
Author

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.

@Zazama
Copy link
Owner

Zazama commented Oct 24, 2021

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()

@PeeJeeDR
Copy link
Author

I will give it a try, thank you!

@pbricout
Copy link
Contributor

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 zlib and fs at runtime and two entry points one injecting for node and another one without default injection

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

No branches or pull requests

3 participants