ArrayBuffer instance
index specifying the location of the first buffer byte (default: 0)
number of buffer bytes (default: buf.byteLength)
new Buffer
instance
var ArrayBuffer = require( `@stdlib/array/buffer` );
var ab = new ArrayBuffer( 10 );
var buf = fromArrayBuffer( ab );
// returns <Buffer>
var ArrayBuffer = require( `@stdlib/array/buffer` );
var ab = new ArrayBuffer( 10 );
var buf = fromArrayBuffer( ab, 2, 4 );
// returns <Buffer>
Allocates a buffer from an
ArrayBuffer
.Notes
The behavior of this function varies across Node.js versions due to changes in the underlying Node.js APIs:
<6.0.0
: if provided an empty ArrayBuffer, the function returns an empty Buffer which is not an ArrayBuffer view.second argument must be a nonnegative integer
second argument must not exceed number of bytes in input ArrayBuffer
last argument must be a nonnegative integer
last argument must not exceed number of bytes in input ArrayBuffer