Skip to content
This repository has been archived by the owner on Mar 16, 2019. It is now read-only.

readStream Crash #247

Closed
naviocean opened this issue Jan 29, 2017 · 1 comment
Closed

readStream Crash #247

naviocean opened this issue Jan 29, 2017 · 1 comment

Comments

@naviocean
Copy link

Hello,
I got an issue that when I tried to set encoded to utf8, readStream method is crashed.

RNFetchBlob.fs.readStream(image.uri,'utf8').then(stream=>{
                      stream.open();
                      stream.onData((chunk)=>{
                     
                      })
                    })

Im using 0.10.2-beta.8
Thanks

@wkh237
Copy link
Owner

wkh237 commented Jan 30, 2017

@naviocean , this error is due to that RCTEventEmitter could not convert JSON strings containing invalid UTF8 characters, I'm afraid this is beyond scope, but I can add exception handling so that it will not crash when dealing with such kind of files.

Alternatively it's possible to use ascii encoding to get byte array of the image, and deal with the bytes, but it has performance drawback especially when the file is large.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.