- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Node.js – v8.deserializer.readUint64() Method
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.
Syntax
v8.deserializer.readUint64()
Parameters
Since 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 1
Create 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 // Importing the v8 module const v8 = require('v8'); // Initializing the serializer object const serializer = new v8.Serializer(); // Writing a 64-bit integer value to the internal buffer serializer.writeUint64(12345, 6789); // Initializing the deserializer object const deserializer = new v8.Deserializer(serializer.releaseBuffer()); console.log(deserializer.readUint64());
Output
C:\home
ode>> node readUint64.js [12345, 6789]
Example 2
Let’s have a look at one more example
// v8.serializer.readUint64() Demo Example // Importing the v8 module const v8 = require('v8'); // Initializing the serializer object const serializer = new v8.Serializer(); var buffer; // Writing a 64-bit integer value to the internal buffer function writeUint64(lo, hi) { serializer.writeUint64(lo, hi) buffer = serializer.releaseBuffer() console.log(buffer) readUint64(buffer) } function readUint64(buffer) { const deserializer = new v8.Deserializer(buffer); console.log(deserializer.readUint64(buffer)); } writeUint64(1234,98765) writeUint64(12.22, 67788) writeUint64(999999,111111)
Output
C:\home
ode>> node readUint64.js <Buffer cd 83 86 80 a0 9a 01> [1234, 98765] <Buffer cc 91 84 80 c0 01> [12, 67788] <Buffer 87 e4 86 80 f0 c7 d0 07> [999999, 111111]
Advertisements