Node.js util.types.isArrayBuffer() Method
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:
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.
Return Value: It returns a boolean value i.e. TRUE if the value is a built-in ArrayBuffer object, FALSE otherwise.
Below examples illustrate the use of util.types.isArrayBuffer() method in Node.js:
Example 1:
const util = require( 'util' );
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" ));
|
Output:
true
false
false
false
Example:
const util = require( 'util' );
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" );
}
|
Output:
Passed value is built in ArrayBuffer
Note: 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
Last Updated :
08 Oct, 2021
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...