Found 285 Articles for Node.js

Node.js – util.types.isInt8Array() Method

Mayank Agarwal
Updated on 18-Aug-2021 08:57:53

37 Views

The util.types.isInt8Array() method checks whether the passed value is a built-in Int8Array instance or not. If the above condition is satisfied, it returns True, else False.Syntaxutil.types.isInt8Array(value)ParametersIt takes a single parameter −value − This input value takes input for the required parameter and checks if it's an Int8Array instance or not.It returns True or False based upon the input value passed.Example 1Create a file with the name "isInt8Array.js" and copy the following code snippet. After creating the file, use the command "node isInt8Array.js" to run this code.// util.types.isInt8Array() Demo Example // Importing the util module const util = require('util'); ... Read More

Node.js – v8.serializer.releaseBuffer() Method

Mayank Agarwal
Updated on 18-Aug-2021 08:56:25

86 Views

The v8.serializer.releaseBuffer() method is used for returning the value stored inthe internal buffer. This method releases all the buffer values and returns it. Releasingan empty buffer results in an undefined behaviour. Also, calling this method if the write was not successful returns "undefined".Syntaxv8.serializer.releaseBuffer()ParametersSince this method releases and returns the buffer, it does not require any inputs.Example 1Create a file with the name "releaseBuffer.js" and copy the following code snippet. After creating the file, use the command "node releaseBuffer.js" to run this code.// v8.serializer.releaseBuffer() example // Importing the v8 module const v8 = require('v8'); // Defining the new v8 ... Read More

Node.js – util.types.isAnyArrayBuffer() Method

Mayank Agarwal
Updated on 18-Aug-2021 08:54:57

46 Views

The util.types.isAnyArrayBuffer() checks whether the passed value is an ArrayBuffer or a SharedArrayBuffer instance. It returns True if the above condition holds, else False.Syntaxutil.types.isAnyArrayBuffer(value)ParametersIt takes a single parameter −value − This input parameter takes input for the required datatype and checks if it's an ArrayBuffer or SharedArrayBuffer instance.It returns True or False based upon the input value passed.Example 1Create a file with the name "isArrayBuffer.js" and copy the following code snippet. After creating the file, use the command "node isArrayBuffer.js" to run this code// util.types.isAnyArrayBuffer() Demo Example // Importing the util module const util = require('util'); // Printing ... Read More

Node.js – v8.deserializer.readRawBytes() Method

Mayank Agarwal
Updated on 18-Aug-2021 08:52:52

94 Views

The v8.deserializer.readRawBytes() method is used for reading the raw bytes from the deserializer’s internal buffer. It basically returns the buffer without deserializing it. The input parameter ‘length’ refers to the length of the buffer that was passed while writing the raw bytes to the same internal buffer.Syntaxv8.deserializer.readRawBytes(length)ParametersIt takes a single parameter −length − This parameter takes input for the length of the buffer that was passed to serializer.writeRawBytes().Example 1Create a file with the name "readRawBytes.js" and copy the following code snippet. After creating the file, use the command "node readRawBytes.js" to run this code.// v8.serializer.readRawBytes() Demo Example // Importing ... Read More

Node.js – util.types.isFloat32Array() Method

Mayank Agarwal
Updated on 18-Aug-2021 08:51:07

35 Views

The util.types.isFloat32Array() method checks whether the passed value is a builtin Float32Array instance or not. If the above condition is satisfied, it returns True, else False.Syntaxutil.types.isFloat32Array(value)ParametersIt takes a single parameter −value − This input value takes input for the required parameter and checks if it's a Float32-Array instance or not.It returns True or False based upon the input value passed.Example 1Create a file with the name – "isFloat32Array.js" and copy the following code snippet. After creating the file, use the command "node isFloat32Array.js" to run this code.// util.types.isFloat32Array() Demo Example // Importing the util module const util = require('util'); ... Read More

Node.js – v8.deserializer.readUint64() Method

Mayank Agarwal
Updated on 18-Aug-2021 08:49:13

101 Views

The v8.deserializer.readUint64() method is used for reading a raw 64-bit unsigned integer and return it as an array with its higher and lower value as follows: [hi, lo]. Both the hi and lo will contain the 32-bit unsigned integer.Syntaxv8.deserializer.readUint64()ParametersSince it reads values from the internal buffer, it does not require any input parameters. It will return the array containing the 64-bit integers in two parts as hi and lo.Example 1Create a file with the name "readUint64.js" and copy the following code snippet. After creating the file, use the command "node readUint64.js" to run this code.// v8.serializer.readUint64() Demo Example // ... Read More

Node.js – util.types.isDate() Method

Mayank Agarwal
Updated on 18-Aug-2021 08:45:58

446 Views

The util.types.isDate() method checks whether the passed value is a built-in Date instance or not. If the above condition is satisfied, it returns True, else False.Syntaxutil.types.isDate(value)ParametersIt takes a single parameter −value − This input value takes input for the required parameter and checks if it's a Date instance or not.It returns True or False based upon the input value passed.Example 1Create a file with the name "isDate.js" and copy the following code snippet. After creating the file, use the command "node isDate.js" to run this code.// util.types.isDate() Demo Example // Importing the util module const util = require('util'); ... Read More

Node.js – v8.getHeapSpaceStatistics() Method

Mayank Agarwal
Updated on 18-Aug-2021 09:25:32

117 Views

The v8.getHeapSpaceStatistics() method returns the statistics about the heap spaces. Both the ordering of the heap spaces and its availability can’t be guaranteed as the statistics are provided by V8 getHeapSpaceStatistics. Since it depends upon the V8 version, it may change from one version to another.Syntaxv8.getHeapSpaceStatistics()ParametersSince it returns the space details/statistics, it does not require any special input parameters. However, the value returned contains the following properties −space_name − This field will represent the name of the heap space.space_size − Size of the space.space_used_size − Size that is currently being used by the V8 and the CPU for processing.space_available_size − ... Read More

Node.js – util.getSystemErrorName() Method

Mayank Agarwal
Updated on 18-Aug-2021 08:40:25

57 Views

The util.getSystemErrorName() method is used for returning the string name of the numeric error code that is returned from the Node.js API. There is a mapping between the error codes and error names which is platform-dependent.Syntaxutil.getSystemErrorName(err)ParametersIt takes a single parameter −err −This parameter takes input as a numeric value that will specify the error number or the error code.The function returns the error name based upon the error code or error number passed in the err parameter.Some common system errors are - EACCES, EEXIST, EISDIR, ENOENT, ENOTDIR, ENOTEMPTY, etc. Browse this page to find the complete information about system error ... Read More

Node.js – v8.serializer.writeDouble() Method

Mayank Agarwal
Updated on 18-Aug-2021 08:38:32

55 Views

The v8.serializer.writeDouble() method is used for writing a double value to the internal buffer. This method is for use inside the serializer._writeHostObject().Syntaxv8.serializer.writeDouble(value)ParametersIt takes a single parameter −value − This parameter takes input for the double value that needs to be written inside the internal buffer.Example 1Create a file with the name "writeDouble.js" and copy the following code snippet. After creating the file, use the command "node writeDouble.js" to run this code.// v8.serializer.writeDouble() Demo Example // Importing the v8 module const v8 = require('v8'); // Defining a new object for v8 serializer const serializer = new v8.Serializer(); // Printing ... Read More

Advertisements