Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • NodeJS Tutorial
  • NodeJS Exercises
  • NodeJS Assert
  • NodeJS Buffer
  • NodeJS Console
  • NodeJS Crypto
  • NodeJS DNS
  • NodeJS File System
  • NodeJS Globals
  • NodeJS HTTP
  • NodeJS HTTP2
  • NodeJS OS
  • NodeJS Path
  • NodeJS Process
  • NodeJS Query String
  • NodeJS Stream
  • NodeJS String Decoder
  • NodeJS Timers
  • NodeJS URL
  • NodeJS Interview Questions
  • NodeJS Questions
  • Web Technology
Open In App
Next Article:
Node.js v8.Serializer.writeUint64() Method
Next article icon

Node.js v8.Serializer.writeUint32() Method

Last Updated : 22 Jul, 2020
Comments
Improve
Suggest changes
Like Article
Like
Report

The v8.Serializer.writeUint32() method is an inbuilt application programming interface of the v8.Serializer module, which is used to write the raw 32-bit integer value to the internal buffer. For use inside of custom serializer._writeHostObject().

Syntax:

v8.Serializer.writeUint32( value );

Parameters: This method accepts single parameter as mentioned above and described below.

  • value: It is a required parameter, refers to a 32-bit integer to be written to the internal buffer.

Return Value: This method does not return anything but writes a raw 32-bit integer value to the internal buffer.

Below examples illustrate the use of v8.Serializer.writeUint32() method in Node.js:

Example 1:

Filename: index.js




// Accessing v8 module
const v8 = require('v8');
const serializer = new v8.Serializer();
  
// Calling v8.serializer.writeUint32() 
// The undefined will be logged in 
// console as this function does not
// return anything
console.log(serializer.writeUint32(5783));
console.log(serializer.releaseBuffer());
 
 

Run index.js file using the following command:

node index.js

Output:

Undefined  <Buffer 97 2d>  

Example 2:

Filename: index.js




// Accessing v8 module
const v8 = require('v8');
const serializer = new v8.Serializer();
  
// Calling v8.serializer.writeUint32() 
console.log(serializer.releaseBuffer());
serializer.writeUint32(29698);
console.log(serializer.releaseBuffer());
  
// Writing two 32 bits number one
// after another
console.log("writing two 32 bits "
    + "number one after another");
  
serializer.writeUint32(29698);
serializer.writeUint32(29698);
console.log(serializer.releaseBuffer());
  
console.log("reading after write");
  
// Calling v8.serializer.writeUint32() 
serializer.writeUint32(5783);
  
// Calling v8.deserializer.readUint32() 
const deserializer = new 
    v8.Deserializer(serializer.releaseBuffer());
console.log(deserializer.readUint32());
 
 

Run index.js file using the following command:

node index.js

Output:

<Buffer >  <Buffer 82 e8 01>  writing two 32 bits number one after another  <Buffer 82 e8 01 82 e8 01>  reading after write  5783  

Reference: https://nodejs.org/api/v8.html#v8_serializer_writeuint32_value



Next Article
Node.js v8.Serializer.writeUint64() Method

V

vyer
Improve
Article Tags :
  • Node.js
  • Web Technologies
  • Node.js-Methods

Similar Reads

    V8 Module APIs

    • Node.js v8.cachedDataVersionTag() Method
      The v8.cachedDataVersionTag() method is an inbuilt application programming interface of the v8 module which is used to get the version tag derived from the v8 version. Syntax: v8.cachedDataVersionTag(); Parameters: This method does not have any parameters. Return Value: This method returns the versi
      1 min read

    • Node.js v8.getHeapSpaceStatistics() Method
      The v8.getHeapSpaceStatistics() method is an inbuilt application programming interface of the v8 module which is used to get statistics about heap space derived from the v8 version. Syntax: v8.getHeapSpaceStatistics(); Parameters: This method does not have any parameters. Return Value: This method r
      2 min read

    • Node.js v8.getHeapStatistics() Method
      The v8.getHeapStatistics() method is an inbuilt application programming interface of the v8 module which is used to get statistics about heap derived from the v8 version. Syntax: v8.getHeapStatistics(); Parameters: This method does not have any parameters. Return Value: This method returns an object
      2 min read

    Serialization API

    • Node.js v8.serialize() Method
      The v8.serialize() method is an inbuilt application programming interface of the v8 module which is used to serialize any type of data into a buffer using default serializer. Syntax: v8.serialize(value); Parameters: This method one parameter as described below and mentioned above. value: This is a r
      2 min read

    • Node.js v8.deserialize() Method
      The v8.deserialize() method is an inbuilt application programming interface of the v8 module which is used to deserialize a buffered data into JS value using default deserializer. Syntax: v8.deserialize( buffer ); Parameters: This method accepts one parameter as mentioned above and described below:
      1 min read

    v8.Serializer Methods

    • Node.js v8.Serializer.writeHeader() Method
      The v8.Serializer.writeHeader() method is an inbuilt application programming interface of the v8.Serializer module, is used to write out a header, that contains the serialization format version. Syntax: v8.Serializer.writeHeader(); Parameters: This method does not have any parameters. Return Value:
      1 min read

    • Node.js v8.Serializer.writeValue() Method
      The v8.Serializer.writeValue() method is an inbuilt application programming interface of the v8.Serializer module which is used to write the serialized data of JS value to the internal buffer. Syntax: v8.Serializer.writeValue(Value); Parameters: This method one parameter as described below and menti
      1 min read

    • Node.js v8.Serializer.releaseBuffer() Method
      The v8.Serializer.releaseBuffer() method is an inbuilt application programming interface of the v8.Serializer module which is used to get content of the internal buffer. Syntax: v8.Serializer.releaseBuffer(); Parameters: This method does not have any parameters. Return Value: This method returns the
      2 min read

    • Node.js v8.Serializer.writeUint32() Method
      The v8.Serializer.writeUint32() method is an inbuilt application programming interface of the v8.Serializer module, which is used to write the raw 32-bit integer value to the internal buffer. For use inside of custom serializer._writeHostObject(). Syntax: v8.Serializer.writeUint32( value ); Paramete
      2 min read

    • Node.js v8.Serializer.writeUint64() Method
      The v8.Serializer.writeUint64() method is an inbuilt application programming interface of the v8.Serializer module which is used to write a raw 64-bit integer value to the internal buffer by splitting into high and low 32-bit integers. For use inside of custom serializer._writeHostObject()method . S
      2 min read

    • Node.js v8.Serializer.writeDouble() Method
      The v8.Serializer.writeDouble() method is an inbuilt application programming interface of the v8.Serializer module which is used to write a JS number value to the internal buffer. For use inside of custom serializer._writeHostObject(). Syntax: v8.Serializer.writeDouble( Value ); Parameters: This met
      1 min read

    • Node.js v8.Serializer.writeRawBytes() Method
      The v8.Serializer.writeRawBytes() method is an inbuilt application programming interface of the v8.Serializer module which is used to write a raw buffer data to the internal buffer. For use inside of custom serializer._writeHostObject(). Syntax: v8.Serializer.writeRawBytes( Buffer ); Parameters: Thi
      1 min read

    v8.Deserializer Methods

    • Node.js v8.Deserializer.readHeader() Method
      The v8.Deserializer.readHeader() method is an inbuilt application programming interface of the v8.Deserializer module which is used to read the header and validate it, to ensure that contains a valid serialization format version. Syntax: v8.Deserializer.readHeader(); Parameters: This method does not
      1 min read

    • Node.js v8.Deserializer.readValue() Method
      The v8.Deserializer.readValue() method is an inbuilt application programming interface of the v8.Deserializer module which is used to read the JS value from serialized data as present in a buffer. Syntax: v8.Deserializer.readValue(); Parameters: This method does not accept any parameters. Return Val
      1 min read

    • Node.js v8.Deserializer.readUint32() Method
      The v8.Deserializer.readUint32() method is an inbuilt application programming interface of the v8.Deserializer module which is used to read a raw 32-bit unsigned integer value from the buffer. For use inside of custom Deserializer._readHostObject(). Syntax: v8.Deserializer.readUint32(); Parameters:
      1 min read

    • Node.js v8.Deserializer.readUint64() Method
      The v8.Deserializer.readUint64() method is an inbuilt application programming interface of the v8.Deserializer module which is used to read a raw 64-bit unsigned integer value from the buffer as an array of 32-bit integers, higher and lower 32-bits separated. For use inside of custom Deserializer._r
      2 min read

    • Node.js v8.Deserializer.readRawBytes() Method
      The v8.Deserializer.readRawBytes() method is an inbuilt application programming interface of the v8.Deserializer module which is used to read a raw buffer data from deserializer's internal buffer of the given length. For use inside of custom Deserializer._readHostObject(). Syntax: v8.Deserializer.re
      2 min read

geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences