AppDividend
Latest Code Tutorials

Javascript ArrayBuffer Example | ArrayBuffer Object Tutorial

0

Javascript ArrayBuffer Example | ArrayBuffer Object Tutorial is today’s topic. The ArrayBuffer object is used to represent the generic, fixed-length raw binary data buffer. You cannot directly manipulate the contents of the ArrayBuffer. ArrayBuffer is used to keep binary data. It can be the binary data of an image for example. ArrayBuffer can be used to get data of jpg image (RGB bytes) and produce a png out of it by adding alpha byte.

Javascript ArrayBuffer Example

The syntax of ArrayBuffer is following.

new ArrayBuffer(length)

The length parameter is the length of the ArrayBuffer which is in the bytes. The length size is in bytes.

See the following example.

// app.js

let app = new ArrayBuffer(6)
console.log(app)

The output is following.

 

Javascript ArrayBuffer Example

We create an 8-byte buffer with an Int32Array view referring to the buffer. See the following example.

 

ArrayBuffer Object Tutorial

Finally, ArrayBuffer Object Tutorial is over.

Leave A Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.