return fromArrayBuffer(value, encodingOrOffset, length)
}
+ if (isInstance(value, SharedArrayBuffer) ||
+ (value && isInstance(value.buffer, SharedArrayBuffer))) {
+ return fromArrayBuffer(value, encodingOrOffset, length)
+ }
+
if (typeof value === 'number') {
throw new TypeError(
'The "value" argument must not be of type number. Received type number'
assert.deepStrictEqual(value, ui32[key]);
}
}
+{
+ const sab = new SharedArrayBuffer(Uint8Array.BYTES_PER_ELEMENT * 4);
+ const ui32 = new Uint8Array(sab).fill(42);
+ const e = Buffer(sab);
+ for (const [key, value] of e.entries()) {
+ assert.deepStrictEqual(value, ui32[key]);
+ }
+}
// Test invalid encoding for Buffer.toString
assert.throws(() => b.toString('invalid'),