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:
// 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" )); |
Output:
true false false false
Example:
// 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" ); } |
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
Please Login to comment...