Update 2016 - five years on there are now new methods in the specs (see support below) to convert between strings and typed arrays using proper encoding.

##TextEncoder

The TextEncoder represents:

The TextEncoder interface represents an encoder for a specific method, that is a specific character encoding, liarraybufferke utf-8, iso-8859-2, koi8, cp1261, gbk, ... An encoder takes a stream of code points as input and emits a stream of bytes.

Change note since the above was written: (ibid.)

Note: Firefox, Chrome and Opera used to have support for encoding types other than utf-8 (such as utf-16, iso-8859-2, koi8, cp1261, and gbk). As of Firefox 48 [...], Chrome 54 [...] and Opera 41, no other encoding types are available other than utf-8, in order to match the spec.*

*) Updated specs (W3) and here (whatwg).

After creating an instance of the TextEncoder it will take a string and encode it using a given encoding parameter:

if (!("TextEncoder" in window)) 
  alert("Sorry, this browser does not support TextEncoder...");

var enc = new TextEncoder(); // always utf-8
console.log(enc.encode("This is a a string to be converted to a Uint8Array"));

You then of course use the .buffer parameter on the resulting Uint8Array to convert the underlaying ArrayBuffer to a different view if needed.

Just make sure that the characters in the string adhere to the encoding schema, for example, if you use characters outside the UTF-8 range in the example they will be encoded to two bytes instead of one.

For general use you would use UTF-16 encoding for things like localStorage.

##TextDecoder

Likewise, the opposite process uses the TextDecoder:

The TextDecoder interface represents a decoder for a specific method, that is a specific character encoding, like utf-8, iso-8859-2, koi8, cp1261, gbk, ... A decoder takes a stream of bytes as input and emits a stream of code points.

All available decoding types can be found here.

if (!("TextDecoder" in window))
  alert("Sorry, this browser does not support TextDecoder...");

var enc = new TextDecoder("utf-8");
var arr = new Uint8Array([84,104,105,115,32,105,115,32,97,32,85,105,110,116,
                          56,65,114,114,97,121,32,99,111,110,118,101,114,116,
                          101,100,32,116,111,32,97,32,115,116,114,105,110,103]);
console.log(enc.decode(arr));

##The MDN StringView library

An alternative to these is to use the StringView library (licensed as lgpl-3.0) which goal is:

  • to create a C-like interface for strings (i.e., an array of character codes — an ArrayBufferView in JavaScript) based upon the JavaScript ArrayBuffer interface
  • to create a highly extensible library that anyone can extend by adding methods to the object StringView.prototype
  • to create a collection of methods for such string-like objects (since now: stringViews) which work strictly on arrays of numbers rather than on creating new immutable JavaScript strings
  • to work with Unicode encodings other than JavaScript's default UTF-16 DOMStrings

giving much more flexibility. However, it would require us to link to or embed this library while TextEncoder/TextDecoder is being built-in in modern browsers.

#Support

As of July/2018:

TextEncoder (Experimental, On Standard Track)

 Chrome    | Edge      | Firefox   | IE        | Opera     | Safari
 ----------|-----------|-----------|-----------|-----------|-----------
     38    |     ?     |    19°    |     -     |     25    |     -

 Chrome/A  | Edge/mob  | Firefox/A | Opera/A   |Safari/iOS | Webview/A
 ----------|-----------|-----------|-----------|-----------|-----------
     38    |     ?     |    19°    |     ?     |     -     |     38

°) 18: Firefox 18 implemented an earlier and slightly different version
of the specification.

WEB WORKER SUPPORT:

Experimental, On Standard Track

 Chrome    | Edge      | Firefox   | IE        | Opera     | Safari
 ----------|-----------|-----------|-----------|-----------|-----------
     38    |     ?     |     20    |     -     |     25    |     -

 Chrome/A  | Edge/mob  | Firefox/A | Opera/A   |Safari/iOS | Webview/A
 ----------|-----------|-----------|-----------|-----------|-----------
     38    |     ?     |     20    |     ?     |     -     |     38

Data from MDN - `npm i -g mdncomp` by epistemex
Answer from user1693593 on Stack Overflow
🌐
Stack Overflow
stackoverflow.com › questions › 39464083 › converting-js-object-to-arraybuffer-to-transfer-to-from-web-worker-equals-bottle
javascript - Converting JS object to ArrayBuffer to transfer to/from web worker equals bottleneck - Stack Overflow
September 13, 2016 - Can't do much about the calculation and the transfer of the ArrayBuffer is quick. But the parsing of this object is however slowing down the process. As the object itself contains arrays of more objects. ... A script on this page may be busy, or it may have stopped responding. You can stop the script now, open the script in the debugger, or let the script continue. Script: http://localhost/js/util/DataViewSerializer.js:435 · Line 435 refers to a function where I serialise an Array.
🌐
MDN Web Docs
developer.mozilla.org › en-US › docs › Web › JavaScript › Reference › Global_Objects › ArrayBuffer
ArrayBuffer - JavaScript - MDN Web Docs
It is an array of bytes, often referred to in other languages as a "byte array". You cannot directly manipulate the contents of an ArrayBuffer; instead, you create one of the typed array objects or a DataView object which represents the buffer in a specific format, and use that to read and write the contents of the buffer.
Discussions

javascript - Converting between strings and ArrayBuffers - Stack Overflow
Is there a commonly accepted technique for efficiently converting JavaScript strings to ArrayBuffers and vice-versa? Specifically, I'd like to be able to write the contents of an ArrayBuffer to More on stackoverflow.com
🌐 stackoverflow.com
JS: How to convert ArrayBuffer to string?
Convert it to a Uint8Array, then convert that to a base64 string with btoa: https://stackoverflow.com/questions/9267899/arraybuffer-to-base64-encoded-string More on reddit.com
🌐 r/learnprogramming
1
1
May 2, 2023
javascript - Create ArrayBuffer from Array (holding integers) and back again - Stack Overflow
It seems so simple, but I cannot find out how to convert an Array filled with integers to an ArrayBuffer and back again to an Array. There are lots of examples where strings are converted to an More on stackoverflow.com
🌐 stackoverflow.com
node.js - How to convert a Javascript Object to a Node Buffer? - Stack Overflow
I'm using Buffer on my node server and Buffer on my Javacript client. For the purposes of saving bytes, I'm looking to send my data to the server through websockets as binary as opposed to JSON. ... More on stackoverflow.com
🌐 stackoverflow.com
🌐
Stack Overflow
stackoverflow.com › questions › 63388575 › how-to-convert-javascript-object-to-arraybuffer
encoding - How to convert Javascript Object to ArrayBuffer? - Stack Overflow
August 13, 2020 - JSON.stringify(encoded) is really weird (and causing problems because it treats the buffer as an object not as an array). Why are you doing that? Send the ArrayBuffer, or at least a JSON array, to the server, which will make everything much easier.
🌐
GeeksforGeeks
geeksforgeeks.org › javascript › how-to-convert-json-to-arraybuffer-in-javascript
How to Convert JSON to ArrayBuffer in JavaScript? - GeeksforGeeks
September 3, 2024 - Below are the following approaches to convert JSON to ArrayBuffer in JavaScript: ... This method utilizes TextEncoder API that encodes text into binary data(0s and 1s) in the form of Uint8Array, this array type is then used to form an ArrayBuffer, ...
🌐
Bobby Hadz
bobbyhadz.com › blog › convert-blob-to-arraybuffer-in-javascript
How to convert a Blob to an ArrayBuffer in JavaScript | bobbyhadz
April 4, 2024 - Use the blob.arrayBuffer() method to convert a Blob to an ArrayBuffer in JavaScript.
Top answer
1 of 16
352

Update 2016 - five years on there are now new methods in the specs (see support below) to convert between strings and typed arrays using proper encoding.

##TextEncoder

The TextEncoder represents:

The TextEncoder interface represents an encoder for a specific method, that is a specific character encoding, liarraybufferke utf-8, iso-8859-2, koi8, cp1261, gbk, ... An encoder takes a stream of code points as input and emits a stream of bytes.

Change note since the above was written: (ibid.)

Note: Firefox, Chrome and Opera used to have support for encoding types other than utf-8 (such as utf-16, iso-8859-2, koi8, cp1261, and gbk). As of Firefox 48 [...], Chrome 54 [...] and Opera 41, no other encoding types are available other than utf-8, in order to match the spec.*

*) Updated specs (W3) and here (whatwg).

After creating an instance of the TextEncoder it will take a string and encode it using a given encoding parameter:

if (!("TextEncoder" in window)) 
  alert("Sorry, this browser does not support TextEncoder...");

var enc = new TextEncoder(); // always utf-8
console.log(enc.encode("This is a a string to be converted to a Uint8Array"));

You then of course use the .buffer parameter on the resulting Uint8Array to convert the underlaying ArrayBuffer to a different view if needed.

Just make sure that the characters in the string adhere to the encoding schema, for example, if you use characters outside the UTF-8 range in the example they will be encoded to two bytes instead of one.

For general use you would use UTF-16 encoding for things like localStorage.

##TextDecoder

Likewise, the opposite process uses the TextDecoder:

The TextDecoder interface represents a decoder for a specific method, that is a specific character encoding, like utf-8, iso-8859-2, koi8, cp1261, gbk, ... A decoder takes a stream of bytes as input and emits a stream of code points.

All available decoding types can be found here.

if (!("TextDecoder" in window))
  alert("Sorry, this browser does not support TextDecoder...");

var enc = new TextDecoder("utf-8");
var arr = new Uint8Array([84,104,105,115,32,105,115,32,97,32,85,105,110,116,
                          56,65,114,114,97,121,32,99,111,110,118,101,114,116,
                          101,100,32,116,111,32,97,32,115,116,114,105,110,103]);
console.log(enc.decode(arr));

##The MDN StringView library

An alternative to these is to use the StringView library (licensed as lgpl-3.0) which goal is:

  • to create a C-like interface for strings (i.e., an array of character codes — an ArrayBufferView in JavaScript) based upon the JavaScript ArrayBuffer interface
  • to create a highly extensible library that anyone can extend by adding methods to the object StringView.prototype
  • to create a collection of methods for such string-like objects (since now: stringViews) which work strictly on arrays of numbers rather than on creating new immutable JavaScript strings
  • to work with Unicode encodings other than JavaScript's default UTF-16 DOMStrings

giving much more flexibility. However, it would require us to link to or embed this library while TextEncoder/TextDecoder is being built-in in modern browsers.

#Support

As of July/2018:

TextEncoder (Experimental, On Standard Track)

 Chrome    | Edge      | Firefox   | IE        | Opera     | Safari
 ----------|-----------|-----------|-----------|-----------|-----------
     38    |     ?     |    19°    |     -     |     25    |     -

 Chrome/A  | Edge/mob  | Firefox/A | Opera/A   |Safari/iOS | Webview/A
 ----------|-----------|-----------|-----------|-----------|-----------
     38    |     ?     |    19°    |     ?     |     -     |     38

°) 18: Firefox 18 implemented an earlier and slightly different version
of the specification.

WEB WORKER SUPPORT:

Experimental, On Standard Track

 Chrome    | Edge      | Firefox   | IE        | Opera     | Safari
 ----------|-----------|-----------|-----------|-----------|-----------
     38    |     ?     |     20    |     -     |     25    |     -

 Chrome/A  | Edge/mob  | Firefox/A | Opera/A   |Safari/iOS | Webview/A
 ----------|-----------|-----------|-----------|-----------|-----------
     38    |     ?     |     20    |     ?     |     -     |     38

Data from MDN - `npm i -g mdncomp` by epistemex
2 of 16
207

Although Dennis and gengkev solutions of using Blob/FileReader work, I wouldn't suggest taking that approach. It is an async approach to a simple problem, and it is much slower than a direct solution. I've made a post in html5rocks with a simpler and (much faster) solution: http://updates.html5rocks.com/2012/06/How-to-convert-ArrayBuffer-to-and-from-String

And the solution is:

function ab2str(buf) {
  return String.fromCharCode.apply(null, new Uint16Array(buf));
}

function str2ab(str) {
  var buf = new ArrayBuffer(str.length*2); // 2 bytes for each char
  var bufView = new Uint16Array(buf);
  for (var i=0, strLen=str.length; i<strLen; i++) {
    bufView[i] = str.charCodeAt(i);
  }
  return buf;
}

EDIT:

The Encoding API helps solving the string conversion problem. Check out the response from Jeff Posnik on Html5Rocks.com to the above original article.

Excerpt:

The Encoding API makes it simple to translate between raw bytes and native JavaScript strings, regardless of which of the many standard encodings you need to work with.

<pre id="results"></pre>

<script>
  if ('TextDecoder' in window) {
    // The local files to be fetched, mapped to the encoding that they're using.
    var filesToEncoding = {
      'utf8.bin': 'utf-8',
      'utf16le.bin': 'utf-16le',
      'macintosh.bin': 'macintosh'
    };

    Object.keys(filesToEncoding).forEach(function(file) {
      fetchAndDecode(file, filesToEncoding[file]);
    });
  } else {
    document.querySelector('#results').textContent = 'Your browser does not support the Encoding API.'
  }

  // Use XHR to fetch `file` and interpret its contents as being encoded with `encoding`.
  function fetchAndDecode(file, encoding) {
    var xhr = new XMLHttpRequest();
    xhr.open('GET', file);
    // Using 'arraybuffer' as the responseType ensures that the raw data is returned,
    // rather than letting XMLHttpRequest decode the data first.
    xhr.responseType = 'arraybuffer';
    xhr.onload = function() {
      if (this.status == 200) {
        // The decode() method takes a DataView as a parameter, which is a wrapper on top of the ArrayBuffer.
        var dataView = new DataView(this.response);
        // The TextDecoder interface is documented at http://encoding.spec.whatwg.org/#interface-textdecoder
        var decoder = new TextDecoder(encoding);
        var decodedString = decoder.decode(dataView);
        // Add the decoded file's text to the <pre> element on the page.
        document.querySelector('#results').textContent += decodedString + '\n';
      } else {
        console.error('Error while requesting', file, this);
      }
    };
    xhr.send();
  }
</script>
🌐
GitHub
gist.github.com › nuclearglow › ab251744db0ebddd504eea28153eb279
ArrayBuffer <-> JSON <-> ArrayBuffer · GitHub
Save nuclearglow/ab251744db0ebddd504eea28153eb279 to your computer and use it in GitHub Desktop. Download ZIP · ArrayBuffer <-> JSON <-> ArrayBuffer · Raw · convert-arraybuffer.js · This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below.
🌐
GitHub
github.com › dy › to-array-buffer
GitHub - dy/to-array-buffer: Convert any binary-like data to ArrayBuffer · GitHub
var toArrayBuffer = require('to-array-buffer') var context = require('audio-context') // Get array buffer from any object ab = toArrayBuffer(new Buffer(100)) ab = toArrayBuffer(new Float32Array(12)) ab = toArrayBuffer(dataURIstr) ab = toArrayBuffer(base64str) ab = toArrayBuffer(ndarray) ab = toArrayBuffer([[0, 1, 0], [1, 0, 1]]) to-arraybuffer − convert Buffer to ArrayBuffer, fast implementation.
Author   dy
Find elsewhere
🌐
Webdevtutor
webdevtutor.net › blog › javascript-buffer-to-arraybuffer
Converting JavaScript Buffer to ArrayBuffer: A Complete Guide
Create a Buffer: First, create a Buffer object with the binary data you want to convert. Allocate an ArrayBuffer: Use the Buffer.buffer property to access the underlying ArrayBuffer that represents the same memory as the Buffer. Slice the ArrayBuffer: If necessary, you can slice the ArrayBuffer ...
🌐
GeeksforGeeks
geeksforgeeks.org › javascript-arraybuffer-constructor
JavaScript ArrayBuffer() Constructor | GeeksforGeeks
May 18, 2023 - JavaScript ArrayBuffer Constructor is used to create a new ArrayBuffer object. ArrayBuffer object is used to represent a generic, fixed-length raw binary data buffer. This object can only be created with the new keyword.
🌐
Rip Tutorial
riptutorial.com › converting between blobs and arraybuffers
JavaScript Tutorial => Converting between Blobs and ArrayBuffers
JavaScript has two primary ways to represent binary data in the browser. ArrayBuffers/TypedArrays contain mutable (though still fixed-length) binary data which you can directly manipulate.
🌐
Reddit
reddit.com › r/learnprogramming › js: how to convert arraybuffer to string?
r/learnprogramming on Reddit: JS: How to convert ArrayBuffer to string?
May 2, 2023 -

Working with Web Push Notifications.

https://developer.mozilla.org/en-US/docs/Web/API/PushSubscription

I got the Push Subscription Object.

I get the keys for p256dh and auth, using PushSubscription.getKey()

Unfortunately, getKey() returns an ArrayBuffer per the docs.

I need to save this subscription object with JSON.stringify(), specifically because I am creating a new object and can't use the toJSON() method which is part of the original Push Subscription Object.

When converting to JSON , ArrayBuffer disappears. So I get an empty object.

Thus, I need to convert the ArrayBuffer to a string before sending to the server.

How do I do this? I saw the Buffer suggested, but thats only available on server side.

🌐
Tabnine
tabnine.com › home › code library
ArrayBuffer JavaScript and Node.js code examples
July 25, 2024 - Get the answers and suggestions you need from our AI code assistant. Get started in minutes with a free 90 day trial of Tabnine Pro.
🌐
JavaScript.info
javascript.info › tutorial › binary data, files
ArrayBuffer, binary arrays
July 11, 2022 - Float64Array – treats every 8 bytes as a floating point number with possible values from 5.0x10-324 to 1.8x10308. So, the binary data in an ArrayBuffer of 16 bytes can be interpreted as 16 “tiny numbers”, or 8 bigger numbers (2 bytes each), or 4 even bigger (4 bytes each), or 2 floating-point values with high precision (8 bytes each). ArrayBuffer is the core object, the root of everything, the raw binary data.
Top answer
1 of 2
67

Yes, there's a simple way without manually writing a loop (the loop still exists somewhere in background):

new Uint16Array([1,2,3]);

That's all. Of course, floating numbers will be rounded down and big numbers will overflow.

Converting typed array to buffer

The buffer of any typed array is accessible through .buffer property, as anyone can read on MDN:

new Uint16Array([1,2,3]).buffer;

Chosing the right typed array

Be warned that mentioned Uint16Array will only hold integers (no floating point) between zero and 65535. To hold any javascript Number1 you will want to use Float64Array - the bigest one, taking 8 bytes total.

1: Which is unrestricted double, which appears to be 64bit IEEE 754 number

Here's a map I have created that maps some of the important information related to number data types:

var NUMBER_TYPE = [
  {name: "uint8",   bytes:1, max:        255,       min: 0,                floating: false, array: Uint8Array},
  {name: "int8",    bytes:1, max:        127,       min: -128,             floating: false, array: Int8Array},
  {name: "uint16",  bytes:2, max:      65535,       min: 0,                floating: false, array: Uint16Array},
  {name: "int16",   bytes:2, max:      32767,       min: -32768,           floating: false, array: Int16Array},
  {name: "uint32",  bytes:4, max: 4294967295,       min: 0,                floating: false, array: Uint32Array},
  {name: "int32",   bytes:4, max: 2147483647,       min: -2147483648,      floating: false, array: Int32Array},
  {name: "float64", bytes:8, max: Number.MAX_VALUE, min: Number.MIN_VALUE, floating: true , array: Float64Array}
];

Float 32 is missing as I was unable to calculate necessary information for it. The map, as it is, can be used to calculate the smallest typed array you can fit a Number in:

function findNumberType(num) {
    // detect whether number has something after the floating point
    var float = num!==(num|0);
    // Prepare the return variable
    var type = null;
    for(var i=0,l=NUMBER_TYPE.length; i<l; i++) {
      // Assume this type by default - unless break is hit, every type ends as `float64`
      type = NUMBER_TYPE[i];
      // Comparison asserts that number is in bounds and disalows floats to be stored 
      // as integers
      if( (!float || type.floating) && num<=type.max && num>=type.min) {
          // If this breaks, the smallest data type has been chosen
          break;
      }
    }
    return type;
}

Used as:

var n = 1222;
var buffer = new (findNumberType(n).array)([n]);

Note that this only works if NUMBER_TYPE is properly ordered.

2 of 2
6

You can't use an ArrayBuffer directly, but you can create a typed array from a normal array by using the from method:

let typedArray = Int32Array.from([-2, -1, 0, 1, 2])
Top answer
1 of 3
24

A buffer's first argument must be a: String, Buffer, ArrayBuffer, Array, or array-like object.

Taking that information into account, we could implement what you are looking for by creating a buffer from a String. It would look something like the following:

let json = [ 5, false, 55, 'asdf' ];

let buffer = Buffer.from(JSON.stringify(json));
console.log('Buffer: ', buffer); // Buffer: <Buffer 5b 20 35 2c 20 66 61 6c 73 65 2c 20 35 35 2c 20 22 61 73 64 66 22 20 5d>

Then you can bring your JSON back like so:

let converted = JSON.parse(buffer);
console.log('Parsed to json', converted); // Parsed to json [ 5, false, 55, 'asdf' ]
2 of 3
20

When we are in NodeJS environment we have much better options than, Buffer.from(JSON.stringify(data)).

Performance wise JSON.stringify + Buffer.from() is ok, but will not work out if the object contains ArrayBuffer, and if done, then very inefficient.

Best way for pure NodeJS based environment

Use "v8 Serialization API" Node JS v8 docs

Its easy to use and built into the Node.js binary.

Its fastest and most space efficient among all the serializers of its kind.

const { serialize, deserialize } = require("v8")

const photo = {
   name: "rabbit",
   height: 1220,
   width: 1440,
   tinyThumbnail: jpegFileAsBuffer,
   mediumThumbnail: anotherJpegFileAsBuffer,
   description: "some string data",
   metaData: {
     tags: ["rabbit", "animal", "runner"],
     type: "image/jpeg"
   }
}

const photoSerializedAsBuffer = serialize(photo)

const deserialisedBack = deserialize(photo)

But only issue is, this only works for NodeJS. And C++ if you wish to use "v8" library(I personally not a fan of doing that).

For multi platform support

Use "bson" (MongoDB BSON)

Performance wise its close to v8 parser, but it can be adapted in all platforms where MongoDB is supported, NodeJS, JS in web, Java, C++, rust, ruby, python....

The usage is exactly like v8 serialization API

const { serialize, deserialize } = require("bson")

const photo = {
   name: "rabbit",
   height: 1220,
   width: 1440,
   tinyThumbnail: jpegFileAsBuffer,
   mediumThumbnail: anotherJpegFileAsBuffer,
   description: "some string data",
   metaData: {
     tags: ["rabbit", "animal", "runner"],
     type: "image/jpeg"
   }
}

const photoSerializedAsBuffer = serialize(photo)

const deserialisedBack = deserialize(photo)

But it can get difficult when BSON types kick in. But this should not be an issue if the object structure is know, and its unlikely that one may not know the object structure while dealing with cross platform stuff.

However a quick, solution for that in NodeJS is to use bson-buffer

At last

This not a full proof solution, but works great for NodeJS and planning to soon launch this for web JS.

tabular-json-node

And due to its simple tabular structure we can support this is other platforms too. Feel free to connect if anyone want to collaborate on this.

🌐
TutorialsPoint
tutorialspoint.com › javascript-arraybuffer-object
JavaScript ArrayBuffer Object
February 25, 2025 - WebAssembly & Performance Optimization: Used in performance-critical applications like image processing and gaming. To create an ArrayBuffer, use the constructor and specify its size in bytes:
🌐
GitHub
gist.github.com › skratchdot › e095036fad80597f1c1a
Array Buffer -> String and String -> ArrayBuffer conversions in javascript · GitHub
What 's the cost of instantiating another ArrayBufferView ? is it minimal right ? I my case I work both with binary and text files and I read both using Uint8Array and this method works fine just passing it directly and in TypeScript I must cast to any: const s = String.fromCharCode.apply(null, anArrayBufferView as any) ... I just posted a TS conversion of this: https://gist.github.com/AndrewLeedham/a7f41ac6bb678f1eb21baf523aa71fd5 feel free to use it. I used Array.from to convert the Uint16Array to a number[]. Casting will also work if you don't want the extra operation.
🌐
npm
npmjs.com › package › to-array-buffer
to-array-buffer - npm
January 6, 2019 - Turn any binary data container into an ArrayBuffer in sync way. Detected containers: ... It also handles some custom data types, like ImageData, AudioBuffer etc., but in general it returns null for objects not looking like binary data containers.
      » npm install to-array-buffer
    
Published   Jan 06, 2019
Version   3.2.0
Author   Dima Yv
🌐
W3Schools
w3schools.com › js › › js_arraybuffers.asp
JavaScript Array Buffer
Browsers may require special security headers to enable SharedArrayBuffer (COOP/COEP). ArrayBuffer is a low-level object representing a fixed-size block of memory