The util.types.isAnyArrayBuffer() method is an inbuilt application programming interface of the util module which is used to perform type checking for any built-in ArrayBuffer objects in the node.js.
Syntax:
javascript
Output:
javascript
Output:
util.types.isAnyArrayBuffer( 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.isAnyArrayBuffer() Method
// Allocating util module
const util = require('util');
// Printing the returned value from
// util.types.isAnyArrayBuffer() method
console.log(util.types.isAnyArrayBuffer(new ArrayBuffer()));
console.log(util.types.isAnyArrayBuffer(new SharedArrayBuffer()));
console.log(util.types.isAnyArrayBuffer(12));
console.log(util.types.isAnyArrayBuffer("geeksforgeeks"));
true true false falseExample 2:
// Node.js program to demonstrate the
// util.types.isAnyArrayBuffer() Method
// Allocating util module
const util = require('util');
// Printing the returned value from
// util.types.isAnyArrayBuffer() method
if (util.types.isAnyArrayBuffer(new ArrayBuffer())) {
console.log("Passed value is either built in "
+ "ArrayBuffer or SharedArrayBuffer ");
}
if (util.types.isAnyArrayBuffer(new SharedArrayBuffer())) {
console.log("Passed value is either built in "
+ "ArrayBuffer or SharedArrayBuffer ");
}
Passed value is either built in ArrayBuffer or SharedArrayBuffer Passed value is either built in ArrayBuffer or SharedArrayBufferNote: The above program will compile and run by using the
node filename.js command.
Reference: https://nodejs.org/api/util.html#util_util_types_isanyarraybuffer_value