The util.types.isArrayBuffer() method is an inbuilt application programming interface of the util module which is used to check for built-in ArrayBuffer type objects in the node.js.
Syntax:
javascript
Output:
javascript
Output:
util.types.isArrayBuffer( value )Parameters: This method accepts single parameter as mentioned above and described below:
- value: It is a required parameter of any datatype.
// Node.js program to demonstrate the
// util.types.isArrayBuffer() Method
// Allocating util module
const util = require('util');
// Printing the returned value from
// util.types.isArrayBuffer() method
console.log(util.types.isArrayBuffer(new ArrayBuffer()));
console.log(util.types.isArrayBuffer(new SharedArrayBuffer()));
console.log(util.types.isArrayBuffer(39));
console.log(util.types.isArrayBuffer("gfg"));
true false false falseExample:
// Node.js program to demonstrate the
// util.types.isArrayBuffer() Method
// Allocating util module
const util = require('util');
// Printing the returned value from
// util.types.isArrayBuffer() method
if (util.types.isArrayBuffer(new ArrayBuffer())) {
console.log("Passed value is built in ArrayBuffer");
}
if (util.types.isArrayBuffer(new SharedArrayBuffer())) {
console.log("Passed value is built in ArrayBuffer");
}
Passed value is built in ArrayBufferNote: The above program will compile and run by using the
node filename.js command.
Reference: https://nodejs.org/api/util.html#util_util_types_isarraybuffer_value