Questions tagged [uint8array]

The Uint8Array typed array represents an array of 8-bit unsigned integers.

162 questions
16
votes
2 answers

Save a memory image (such as Uint8list) as image file in flutter

I have some Uint8lists and I want to save them as jpg files. Can anyone help?
M.Taha Basiri
  • 612
  • 1
  • 6
  • 14
16
votes
1 answer

Node.js - Buffer vs Uint8Array

In the documentation 1 of the fs module, we can read (for the writeFile method): const data = new Uint8Array(Buffer.from('Hello Node.js')); In the same documentation 2 it is said: With TypedArray now available, the Buffer class implements the …
erwan
  • 311
  • 1
  • 3
  • 9
7
votes
1 answer

Convert uint8list image to a supported Image file(jpg or etc.)

In android 10 and 11 (SDK number 29 and 30) music covers (artworks) formats aren't the same as previous versions, in fact, they aren't readable as a supported image file such as jpg or png, they are uint8lists and only Image.memory widget accepts…
M.Taha Basiri
  • 612
  • 1
  • 6
  • 14
7
votes
2 answers

In Javascript (but not Node), how do I divde two Uint8Arrays?

I'm using in-browser Javascript, not NodeJS. I have two Uint8Arrays ... var d1 = new Uint8Array([255, 255, 255, 255, 255, 255, 255, 255]) var d2 = new Uint8Array([255, 255, 255, 255, 237, 49, 56, 0]) Each will have exactly 8 elements that are…
satish
  • 703
  • 5
  • 23
  • 52
7
votes
3 answers

How do I initialize a Uint8Array?

I want to create a Uint8Array with 8 elements. I tried this var myarr = new Uint8Array(255,255,255,255,40,92,143,2); but when I run myarr.length I get back "255" when I expect the answer would be "8". I assume I'm doing somethign wrong in my…
satish
  • 703
  • 5
  • 23
  • 52
6
votes
2 answers

Compare equality of two Uint8Array

I am comparing two Uint8Array using CRC32 to ensure the accuracy of the data being decompressed. However, I am facing the issue of not having an API like Uint8Array.equal() to compare the arrays. Although there is Buffer.compare() available in…
Filip Seman
  • 1,252
  • 2
  • 15
  • 22
6
votes
3 answers

JavaScript: TextDecoder on SharedArrayBuffer

I am facing a problem with decode() on SharedArrayBuffer. Code: var sharedArrayBuffer = new SharedArrayBuffer(2); var uint8Array = new Uint8Array(sharedArrayBuffer); uint8Array[0] = 20; var decoder = new TextDecoder(); …
6
votes
3 answers

Swift 3.0 convert Data to Array

How to convert Data to array of UInt8? func serialPort(_ serialPort: ORSSerialPort, didReceive data: Data) { print("recieved:\(data)") let arr: [UInt8] = Data(???)??? } log recieved:70 bytes
AleyRobotics
  • 970
  • 1
  • 10
  • 17
5
votes
2 answers

Decode a Uint8Array into a JSON

I am fetching data from an API in order to show sales and finance reports, but I receive a type gzip file which I managed to convert into a Uint8Array. I'd like to somehow parse-decode this into a JSON file that I can use to access data and create…
Jacopo
  • 143
  • 1
  • 1
  • 10
5
votes
1 answer

How to use and convert an image file into Uint8Array in react native?

I am working on React-Native-OpenPGP for Encryption and Decryption. I want to take an image from my folder (local image fetch)/ Image url and convert that image into Uint8Array for encryption/Decryption . I am new to react native , Not able to find…
Diksha235
  • 442
  • 7
  • 17
5
votes
1 answer

Java convert byte[] to BigInteger

In Java, I can get a BigInteger from a String like this: public static void main(String[] args) { String input = "banana"; byte[] bytes = input.getBytes(StandardCharsets.UTF_8); BigInteger bigInteger = new BigInteger(bytes); …
5
votes
2 answers

Javascript combine ArrayBuffer parts

I need to combine 2 parts of 2 existing arrayBuffers into a new one. I am building a parser and the data comes in arraybuffers of random sizes, the data will spill over the end of one, into the beginning of the other. So I need to create a new…
brianxautumn
  • 1,162
  • 8
  • 21
4
votes
3 answers

How to encode integer to Uint8Array and back to integer in JavaScript?

I need to add compression to my project and I decided to use the LZJB algorithm that is fast and the code is small. Found this library https://github.com/copy/jslzjb-k But the API is not very nice because to decompress the file you need input buffer…
jcubic
  • 61,973
  • 54
  • 229
  • 402
4
votes
0 answers

JavaScript: what is the fastest hexadecimal string to ArrayBuffer algorithm?

Looking for a performant algorithm for parsing any-length hexadecimal strings into Uint8Arrays. I specifically care about use with Chrome and Firefox's engines. A common approach used in code snippets: function hex2bytes(string) { const normal =…
4
votes
0 answers

Viability of Typed Arrays in javascript in terms of performance?

I am in the process of writing a javascript library for multiple precision arithmetic. Essentially, storing a number as an array of digits and applying operations on them. I have recently discovered javascript's Typed Arrays, and am considering…
1
2 3
10 11