MCPcopy Index your code
hub / github.com/nodejs/node / transferArrayBuffer

Function transferArrayBuffer

lib/internal/modules/esm/worker.js:88–101  ·  view source on GitHub ↗

* Transfers an ArrayBuffer, TypedArray, or DataView to a worker thread. * @param {boolean} hasError - Whether an error occurred during transfer. * @param {ArrayBuffer[] | TypedArray | DataView} source - The data to transfer. * @returns {ArrayBuffer[]|undefined}

(hasError, source)

Source from the content-addressed store, hash-verified

86 * @returns {ArrayBuffer[]|undefined}
87 */
88function transferArrayBuffer(hasError, source) {
89 if (hasError || source == null) { return; }
90 let arrayBuffer;
91 if (isArrayBuffer(source)) {
92 arrayBuffer = source;
93 } else if (isTypedArray(source)) {
94 arrayBuffer = TypedArrayPrototypeGetBuffer(source);
95 } else if (isDataView(source)) {
96 arrayBuffer = DataViewPrototypeGetBuffer(source);
97 }
98 if (arrayBuffer && !isMarkedAsUntransferable(arrayBuffer)) {
99 return [arrayBuffer];
100 }
101}
102
103/**
104 * Wraps a message with a status and body, and serializes the body if necessary.

Callers 1

handleMessageFunction · 0.70

Calls 3

isTypedArrayFunction · 0.85
isDataViewFunction · 0.85
isMarkedAsUntransferableFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…