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

aurora.js with react-native #200

Open
iPhaeton opened this issue Sep 13, 2017 · 2 comments
Open

aurora.js with react-native #200

iPhaeton opened this issue Sep 13, 2017 · 2 comments

Comments

@iPhaeton
Copy link

Hi, is it possible to use aurora.js with react-native?
I tried this method: https://medium.com/@aakashns/using-core-node-js-modules-in-react-native-apps-64acd4d07140 an managed to have aurora.js read an asset from file using AV.Asset.fromFile();.
But when I try asset.decodeToBuffer(), I get the following error:

Failed to execute 'readAsArrayBuffer' on 'FileReader': parameter 1 is not of type 'Blob'.

@shavavo
Copy link

shavavo commented Oct 10, 2019

Hi, could you share how you resolved this?

@iPhaeton
Copy link
Author

iPhaeton commented Oct 11, 2019

Hi. It was a long time ago... If I'm not mistaking, I had to read a file into a buffer and create the asset from that buffer, like this:

import RNFS from 'react-native-fs';
import b64AB from 'base64-arraybuffer';

...

const file = await RNFS.readFile(path, 'base64');
const buffer = b64AB.decode(file);
const asset = AV.Asset.fromBuffer(buffer);

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

No branches or pull requests

2 participants