Monday, 3 June 2019

Ionic native file plugin: file.readAsArrayBuffer() => Uncaught RangeError: Array buffer allocation failed

I doing a intership project in Ionic. In this project, I have to read mbtiles files (via the @ionic-native/file plugin) and put them in leaflet (via the leaflet-tilelayer-mbtiles-tsplugin for leaflet). i do it like this:

this.file.readAsArrayBuffer(PATH, MBITILEFILENAME).then(res =>{
                L.tileLayer.mbTiles(res,{
                    maxZoom: 18,
                    attribution: "mbtiles"
                }).addTo(this.map)
            })

As I don't use the Ionic test app for some reasons, I have to test my app directly on the phone, and use Android studio console to see what's going on.

Here's the problem:
When I use a little mbtiles file (10Mo, testing file) it work, but when I use a bigger file (880Mo, file it has to read in prod environment) Android Console read me this:

I/chromium: [INFO:CONSOLE(312)] "Uncaught RangeError: Array buffer allocation failed", source: http://localhost/cordova.js (312)

I tried to search for the file.readAsArrayBuffer() size limit, but I found nothing.

Can you tell me what is thefile.readAsArrayBuffer() size limit? Any solution to bypass this limit with Ionic? Or something that can solve my problem?



from Ionic native file plugin: file.readAsArrayBuffer() => Uncaught RangeError: Array buffer allocation failed

No comments:

Post a Comment