Workers

worker_threads.markAsUntransferable()

Prevents a marked object from being transferred. This is a local ownership rule, not a way to make object contents confidential. Tested on Node.js 22.16.0. Example output (one line per entry): ["true"].

Formal Syntax & Structure

nodejs syntaxnodejs
markAsUntransferable(object)

Parameters & Attributes

NameTypeDescription
objectobjectObject to mark.

Return Value

undefined

Marks the object.

Working Example

Example Snippetnodejs
import { markAsUntransferable, isMarkedAsUntransferable } from 'node:worker_threads';const a = new ArrayBuffer(8);markAsUntransferable(a);console.log(isMarkedAsUntransferable(a));
Node.js Reference