question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

fetch arrayBuffer Android

See original GitHub issue

Tried to fetch a local file into an Array Buffer. First try with XHR. iOS: ok - Android: faild. Second try with fetch. Same result again. This is my script error or tabris.js error?

Textscript

var filename = tabris.app.getResourceLocation('src/img/framework7.png');
console.log(filename);

fetch(filename).then(function(response) {
    return response.arrayBuffer();
  }).catch(function(err) {
	console.error(err);
  }).then(function(buffer) {
	console.log(typeof buffer);
	console.log(buffer);
});

Output (iOS, Android) bildschirmfoto 2017-05-17 um 22 16 49

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:20 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
ghostcommented, May 18, 2017

@mpost you only get my trouble - but behind: tabris.js really rocks!

0reactions
ghostcommented, May 24, 2017

@karolszafranski Thanks for this tip! With tonights nightly platform I tested successful to get arrayBuffer, text, json. Thank you! I will close this issue.

By the way: I read about a common method: users always choose response.text and convert the result into required destination type. So they can handle malformed files better - e.g. malformed json.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is there a way to pass an arraybuffer from javascript to java on ...
I have a webview on Android 4.4.3 where I have a webapp who has float32array containing binary data. I would like to pass...
Read more >
Response.arrayBuffer() - Web APIs - MDN Web Docs
The arrayBuffer() method of the Response interface takes a Response stream and reads it to completion. It returns a promise that resolves ...
Read more >
support ArrayBuffer as fetch body · Issue #9947 - GitHub
Issue Description fetch simply pass an arraryBuffer to XMLHttpRequest as body, ... React Native version: 0.33.0; Platform(s) (iOS, Android, ...
Read more >
ByteBuffer | Android Developers
Absolute and relative get and put methods that read and write values of other primitive types, translating them to and from sequences of...
Read more >
Body.arrayBuffer() - Web APIs
In our fetch array buffer live, we have a Play button. When pressed, the getData() function is run. Note that before playing full...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found