Questions tagged [arraybuffer]

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

597 questions
4
votes
2 answers

How to Read 64-bit Integer from an ArrayBuffer / DataView in JavaScript

Given a 64-bit (8-byte) little-endian ArrayBuffer of bytes, how can we read 64-bit integer values in JavaScript? I experimented and came up with this, but is there a more elegant solution given that DataView does not yet provide getUint64()? const…
anthumchris
  • 8,245
  • 2
  • 28
  • 53
4
votes
2 answers

Reconstructing file/folder structure of a decompressed zip file in JS

I am trying to reconstruct the file/folder structure of a decompressed zip file in the browser with JavaScript. Ideally, I'd like to have all files in a FileList (as if they just got uploaded through a web page) or other iterable object. For…
Daniel Schreij
  • 773
  • 1
  • 10
  • 26
4
votes
1 answer

How to ES6 Proxy an ArrayBuffer or Uint8Array?

These work: crypto.subtle.digest('SHA-512', new Uint8Array([0])) crypto.subtle.digest('SHA-512', new Uint8Array([0]).buffer) These don't: crypto.subtle.digest('SHA-512', new Proxy(new Uint8Array([0]),{})) crypto.subtle.digest('SHA-512', new…
Mihail Malostanidis
  • 2,686
  • 3
  • 22
  • 38
4
votes
1 answer

How to read/write data to ArrayBuffer from C++ Node.js addon?

In short, I have an addon that completes an operation which results in a uint8_t array. I need to convert this array and its contents to an ArrayBuffer, and return that. Conversely, the addon can also accept an ArrayBuffer as input, and I need to…
S. Vaughn
  • 86
  • 1
  • 7
4
votes
2 answers

Copy data into v8::ArrayBuffer

I'm writing a Javascript interpreter in C++ using v8. I need to pass a char buffer into an ArrayBuffer so that it gets garbage collected. Here is my code: QByteArray data_buffer(file.readAll().data(), file.size()); v8::Handle ab =…
4
votes
2 answers

CryptoKey ArrayBuffer to base64 and Back

I was wondering how do I solve this problem. I generate RSA-OAEP keypair using WebCrypto API, then I export private key in pkcs8 from the keypair which exports as ArrayBuffer and I want to encode this ArrayBuffer into base64 so I can store it as a…
Peter Bielak
  • 643
  • 2
  • 12
  • 24
4
votes
2 answers

How to create a textual binary representation of an image in JavaScript?

For a little project I would like to convert an image to a binary representation (zeroes and ones). As I want to use this on a machine that is not configured to run PHP, .NET, ... I would like to do this in JavaScript. At the moment I managed to…
Jules
  • 7,148
  • 6
  • 26
  • 50
4
votes
1 answer

Loading mp3 as ArrayBuffer using local file for Web Audio

i wish load a mp3 local file and next using a library for processing, i cant use XMLHttpRequest, then i use the next code for read a local mp3 file:
gurrumo
  • 83
  • 2
  • 10
4
votes
4 answers

how to convert arraybuffer to string

I have written a simple TCP server on node.js to send some data to a Chrome app. In the chrome app, when I get the data, I convert that to string using below function, I get an exception "byte length of Uint16Array should be a multiple of…
Kapil
  • 9,469
  • 10
  • 40
  • 53
4
votes
4 answers

How does ArrayBuffer works in memory?

I want to use ArrayBuffer in my program to keep list of numbers. I want to use it as queue. Each time delete the first item in the list and use it. Then I was wondering each time that I am deleting the first item do all other numbers in the queue…
Mahsa
  • 1,502
  • 7
  • 18
  • 40
4
votes
2 answers

ArrayBuffer.prototype.slice shim for IE?

Internet Explorer doesn't implement ArrayBuffer.prototype.slice. Amazingly, they don't plan on implementing it any time soon. As such, are there any shims out there for this function? If not then this shall be the canonical answer on the internet as…
Claudiu
  • 224,032
  • 165
  • 485
  • 680
3
votes
1 answer

Sending binary data from browser

I wanted to know what I must do for sending data in binary type from client to server? I am using Chrome 14, and when I send an ArrayBuffer in the client application, I receive a frame with the opcode set to opText and a string as frame data …
Antoine
  • 910
  • 1
  • 9
  • 26
3
votes
1 answer

Strange limitation in ArrayBufferView constructor

The TypedArray specification states that an ArrayBufferView may be created this way: TypedArray(ArrayBuffer buffer, optional unsigned long byteOffset, optional unsigned long length) However, the second parameter, byteOffset, has a…
bionic
  • 78
  • 7
3
votes
1 answer

NestJS req.body from POST method is empty/undefined when awaiting ArrayBuffer

I am trying to send file from Client (Angular) to the NestJS same way like it is working now with Java-springboot API. I am using POST method in NestJS but, unfortunatelly I am not able to got any data from the body : here is the code : …
strakz
  • 101
  • 2
  • 10
3
votes
1 answer

How to convert an arrayBuffer to readableStream in typescript?

I'm using Pinata's pinFileToIPFS() function that requires a ReadableStream to upload to Pinata's IPFS nodes. I have the bytearray of the file, for example of a PNG. I want to convert this byteArray to readableStream and upload this on IPFS. How can…
user16560224