JavaScript SharedArrayBuffer Methods

Beginner
4 min read
Updated: Nov 2026
2 method guides
Method index

About This Index

This page is the JavaScript SharedArrayBuffer Methods index. A SharedArrayBuffer has two methods of its own. Each row below links to a full guide with syntax, examples you can run, and FAQs.

Learn what a SharedArrayBuffer is on /js/shared-array-buffer. Use this page when you need a specific method such as grow().

Both methods are called on a buffer.

First create one with new SharedArrayBuffer(length). Then call buffer.grow() to make a growable buffer bigger, or buffer.slice() to copy a range of bytes. They are instance methods, not static ones.

How to Call a SharedArrayBuffer Method

Create a buffer, then call the methods on it:

JavaScript
const buffer = new SharedArrayBuffer(4, { maxByteLength: 16 });

buffer.grow(8);                          // make it bigger
console.log(buffer.byteLength);          // 8

const copy = buffer.slice(0, 4);         // copy the first 4 bytes
console.log(copy.byteLength);            // 4
console.log(copy === buffer);            // false

JavaScript SharedArrayBuffer Methods Table

All method guides in this JavaScript tutorial series (2 tutorials), grouped by what they do.

Change the size

1 method

Make a shared buffer bigger without creating a new one.

MethodDescriptionTutorial
grow()Make a growable buffer bigger in place, up to maxByteLength. It can never shrink.Open

Copy bytes

1 method

Take a copy of part of a buffer, or all of it.

MethodDescriptionTutorial
slice()Copy a range of bytes into a new, separate SharedArrayBuffer. Negative positions count from the end.Open

Frequently Asked Questions

Two: grow() makes a growable buffer bigger in place, and slice() copies a range of bytes into a new SharedArrayBuffer. It also has the properties byteLength, growable and maxByteLength.
The SharedArrayBuffer page explains the idea: shared memory, views, Atomics and how it compares with ArrayBuffer. This index lists the method guides so you can jump straight to grow() or slice().
No. Both are instance methods. You call them on a buffer that you created with new, as in buffer.grow(16), and not on SharedArrayBuffer itself.
No. A SharedArrayBuffer can only grow, with grow(). The methods resize() and transfer() belong to ArrayBuffer, because a shared buffer cannot shrink and is never moved away from its owner.
Start with grow() to learn how growable buffers and maxByteLength work, then read slice() to learn how to copy bytes. If you want the big picture first, read the SharedArrayBuffer page.

Start with grow()

Open the guide for growing a shared buffer: syntax, examples, and FAQs.

grow() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

9 people found this page helpful