The v8 module exposes APIs that are specific to the version of V8 built into the Node.js binary.
Example:
Javascript
const v8 = require('v8');
console.log(v8.getHeapStatistics());
|
Output:
{ total_heap_size: 6537216,
total_heap_size_executable: 1048576,
total_physical_size: 6537216,
total_available_size: 1520717240,
used_heap_size: 4199600,
heap_size_limit: 1526909922,
malloced_memory: 8192,
peak_malloced_memory: 406408,
does_zap_garbage: 0 }
The Complete list of V8 are listed below:
V8 Module APIs
Serialization API
|
Serialization API
|
Description
|
| v8.serialize() |
Serialize any type of data into a buffer using default serializer. |
| v8.deserialize() |
Deserialize a buffered data into JS value using default deserializer. |
Class: v8.Serializer
|
Class: v8.Serializer Methods
|
Description
|
| writeHeader() |
Write out a header, that contains the serialization format version. |
| writeValue() |
Write the serialized data of JS value to the internal buffer. |
| releaseBuffer() |
Get content of the internal buffer. |
| writeUint32() |
Write the raw 32-bit integer value to the internal buffer.. |
| writeUint64() |
Write a raw 64-bit integer value to the internal buffer by splitting into high and low 32-bit integers. |
| writeDouble() |
Write a JS number value to the internal buffer. For use inside of custom serializer._writeHostObject(). |
| writeRawBytes() |
Write a raw buffer data to the internal buffer. |
Class: v8.Deserializer
|
Class: v8.Deserializer Methods
|
Description
|
| readHeader() |
Read the header and validate it, to ensure that contains a valid serialization format version. |
| readValue() |
Read the JS value from serialized data as present in a buffer. |
| readUint32() |
Read a raw 32-bit unsigned integer value from the buffer. |
| readUint64() |
Read a raw 64-bit unsigned integer value from the buffer as an array of 32-bit integers, higher and lower 32-bits separated. |
| readRawBytes() |
Read a raw buffer data from deserializerâs internal buffer of the given length. |
Learn to code easily with our course
Coding for Everyone. This course is accessible and designed for everyone, even if you're new to coding. Start today and join millions on a journey to improve your skills!Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape,
GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out -
check it out now!
Commit to GfG's Three-90 Challenge! Purchase a course, complete 90% in 90 days, and save 90% cost click here to explore.
Last Updated :
22 Mar, 2023
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...