Questions tagged [arraybuffer]

ArrayBuffer is a Javascript data type used to represent a generic, fixed-length binary data buffer.

597 questions
3
votes
1 answer

How to draw pixels from an arraybuffer to the canvas very fast?

I have an asmjs module, which works on an ArrayBuffer called 'MEM'. The repaint function is called in every loop. In the first 'siz' bytes are the pixel colors stored. My code works, but it runs slow. Is it possible to make it faster somehow? The…
Iter Ator
  • 8,226
  • 20
  • 73
  • 164
3
votes
1 answer

imageData set in InternetExplorer

I have an arraybuffer - named MEM - larger than the canvas width*height size. And I would like to draw the arrayBuffer data to the canvas. imgData.data.set(...) should work, because imgData.data is an Uint8Array, which has the .set hethod. It works…
Iter Ator
  • 8,226
  • 20
  • 73
  • 164
3
votes
1 answer

Comparison: Resizing ArrayBuffer with buffer views (Uint8 vs Float64), am I missing something?

I've been looking up ways how to resize ArrayBuffers and I've come to the following two methods: 1 (Uint8Array): function resizeUint8(baseArrayBuffer, newByteSize) { var resizedArrayBuffer = new ArrayBuffer(newByteSize), resizedView =…
N. Taylor Mullen
  • 18,061
  • 6
  • 49
  • 72
3
votes
1 answer

Understanding the concept of typed arrays in JavaScript

I want to know what are typed arrays in JavaScript (e.g. Int16Array, Uint32Array, Uint8ClampedArray, etc.). I am new to this byte level concept, as in I don't really get what is being said. For example if you take a look at this article when it…
Techsin
  • 514
  • 3
  • 18
3
votes
1 answer

How to efficiently convert THREE.Geometry to ArrayBuffer, File or Blob?

I'd like to move a piece of my code in which i build a THREE.Geometry object to a HTML5 Web Worker. Since i don't want to serialize it to a string (for obvious performance purposes), i'd like to convert it to a Transferable Object like ArrayBuffer,…
Sebastien
  • 682
  • 1
  • 14
  • 26
3
votes
1 answer

Accessing ArrayBuffer from PHP $_POST after xmlHTTPrequest send()

I'm following the tuitions on XMLHttpRequest 2 from : https://developer.mozilla.org/en/DOM/XMLHttpRequest/Sending_and_Receiving_Binary_Data and http://www.html5rocks.com/en/tutorials/file/xhr2/#toc-send-arraybuffer They're great tutorials for the…
Dan
  • 83
  • 1
  • 8
2
votes
1 answer

NodeJS stream pausing/resuming does not work with XMLHttpRequest, but works with curl?

This is a pretty esoteric issue that I can't produce a small test case for, so sorry in advance. But maybe someone has run into something like it previously. I have code like this (using restify): server.put("/whatever", function (serverRequest,…
Domenic
  • 110,262
  • 41
  • 219
  • 271
2
votes
2 answers

Bitwise operators in Javascript and in general

I am working on parsing some binary files, I have them opened and in an ArrayBuffer. In the particular file structure I am reading, there are a number of bits which are boolean and I can check whether they are checked with: (flag & 1) != 0; // bit 0…
user787497
2
votes
0 answers

file handling on node js which is better FileReader or Buffer.from(arrayBuffer)

which is more efficient on nodejs server 1) let file :File = (await formData()).get('input-png') let arrayBuffer = file.arrayBuffer() buffer = Buffer.from(arrayBuffer) 2) let file :File = (await formData()).get('input-png') let reader = new…
2
votes
1 answer

Fetch raw gzip-encoded web page into Uint8Array

I'm using fetch to retrieve a URL. This is in code that is acting as a proxy and if it gets a response with content-encoding: gzip, I want to get the raw data so I can send it back to the consumer without decoding it. But I see no way to do this. …
2
votes
1 answer

React Image: createObjectURL link gives error 404 (Not Found)

I created an ImageUrl using the following code in React with Typescript. It made a URL, however does not show a picture image. Clicking on the URL eg "http://localhost:3003/0b4de100-d8eb-49a7-b43a-e2147310abbe" gives error below. How can I fix this…
mattsmith5
  • 540
  • 4
  • 29
  • 67
2
votes
1 answer

Javascript - Typed Arrays to store booleans - ArrayBuffer: what's the point with byteOffset?

I would like to store boolean values into a Javascript Typed Array. Originally I wanted to have a bidimensional array (making a small Game of Life actually) but it is not possible according to this post : javascript multidimensional Typed array…
Zabon
  • 241
  • 2
  • 18
2
votes
1 answer

Download PDF in browser with blob

I can not quite wrap my head around on how to download a PDF from a google spreadsheet PDF Export Weblink. I generated a testing spreadsheet for this case. I understand that I need to implement encodeURIComponent and/or "Buffer.from" to the blob but…
Kristian
  • 83
  • 1
  • 3
  • 8
2
votes
1 answer

Range header, video

First of all, don't ask me why I'm duing this thing, but I'm just curious if I can attain it. I request a video from a server using the Range-header. The server sends me a buffer data of the video. In general I have about 3 request and then I have…
2
votes
1 answer

Javascript Webworker how to put json information into array buffer

I have thousands of small strings that I have to pass from a webworker back to the main page, each one is something like this: "this string needs to be sent" How would I be able to include it into an array buffer in order to increase the transfer…
user16791137
  • 111
  • 6