VOOZH about

URL: https://www.geeksforgeeks.org/node-js/node-js-util-types-isdataview-method/

⇱ Node.js | util.types.isDataView() Method - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Node.js | util.types.isDataView() Method

Last Updated : 28 Apr, 2025

The util.types.isDataView() method method of util module is primarily designed to support the needs of Node.js own Internal APIs. 
The util.types.isDataView() method is used to check if the given value is a DataView object or not.
 

Syntax: 

util.types.isDataView(value)

Parameters: This function accepts one parameter as mentioned above and described below: 
  • value: It is the value that would be checked for a DataView object.


Return Value: This method returns a Boolean value i.e. true if the passed value is instance of DataView otherwise returns false.
 

Below programs illustrate the util.types.isDataView() method in Node.js:
 

Example 1:

Output:

Value: DataView {
 byteLength: 5,
 byteOffset: 0,
 buffer: ArrayBuffer { [Uint8Contents]:
 <00 00 00 00 00>, byteLength: 5 }
}
Value is a DataView: true
Value: Int32Array []
Value is a DataView: false

Example 2:
 

Output:

Value: Uint8Array [ 10, 20, 30 ]
Value is a View: true
Value is a DataView: false
Value: DataView {
 byteLength: 3,
 byteOffset: 0,
 buffer: ArrayBuffer { [Uint8Contents]: 
 <0a 14 1e>, byteLength: 3 }
}
Value is a View: true
Value is a DataView: true

Reference: https://nodejs.org/api/util.html#util_util_types_isdataview_value
Comment

Explore