- 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.serializer.writeUint64() Method
The v8.serializer.writeUint64() method is used for writing a raw 64-bit unsigned integer to the internal buffer. The number is split into high and low 32-bit integers.
Syntax
v8.serializer.writeUint64(high, low)
Parameters
The parameters are defined below:
- high − This parameter takes input for the higher 32-bit of the 64-bit integer that will be return in the internal buffer.
- low − This parameter takes input for the low 32-bit of the 64-bit integer that will be return in the internal buffer.
Example 1
Create a file with the name "writeUint64.js" and copy the following code snippet. After creating the file, use the command "writeUint64.js" to run this code.
// v8.serializer.writeUint64() Demo Example // Importing the v8 module const v8 = require('v8'); // Defining a new object for v8 serializer const serializer = new v8.Serializer(); // Printing the 64-bit integer in the internal buffer console.log(serializer.writeUint64(12345, 56789)); console.log(serializer.releaseBuffer());
Output
C:\home
ode>> node writeUint64.js undefined <Buffer d5 bb 83 80 90 87 0c>
Example 2
Let’s take a look at another example
// v8.serializer.writeUint64() Demo Example // Importing the v8 module const v8 = require('v8'); // Defining a new object for v8 serializer const serializer = new v8.Serializer(); // Printing the 64-bit integer in the internal buffer console.log(serializer.writeUint64(12345, 56789)); // Defining the deserializer object const deserializer = new v8.Deserializer(serializer.releaseBuffer()); console.log(deserializer.readUint64());
Output
C:\home
ode>> node writeUint64.js undefined [ 12345, 56789 ]
Advertisements