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.writeUint32() Method
Next article icon

Node.js v8.Serializer.releaseBuffer() Method

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

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 content of the internal buffer.

It is not preferable to use the serializer once the buffer is released. Calling this may cause returning undefined if the previous write operation fails.

The below examples illustrate the use of v8.Serializer.releaseBuffer() method in Node.js.

Example 1: Filename: index.js




// Accessing v8 module
const v8 = require('v8');
const serializer = new v8.Serializer();
  
// Calling v8.serializer.releaseBuffer() 
console.log(serializer.releaseBuffer());
console.log(serializer.writeHeader());
console.log(serializer.releaseBuffer());
 
 

Run index.js file using the following command:

node index.js

Output:

<Buffer >  undefined  <Buffer ff 0d>  

Example 2: Filename: index.js




// Accessing v8 module
const v8 = require('v8');
const serializer=new v8.Serializer();
  
// Calling v8.serializer.releaseBuffer() 
console.log(serializer.releaseBuffer());
console.log(serializer.writeValue("geeksforgeeks"));
console.log(serializer.releaseBuffer());
console.log(serializer.writeValue(9314.94));
console.log(serializer.releaseBuffer());
  
// Appending one after another
console.log(serializer.writeValue("geeksforgeeks"));
console.log(serializer.writeValue(9314.94));
console.log(serializer.releaseBuffer());
 
 

Run index.js file using the following command:

node index.js

Output:

<Buffer >  true  <Buffer 22 0d 67 65 65 6b 73 66 6f 72 67 65 65 6b 73>  true  <Buffer 4e 1f 85 eb 51 78 31 c2 40>  true  true  <Buffer 22 0d 67 65 65 6b 73 66 6f 72 67 65 65   6b 73 4e 1f 85 eb 51 78 31 c2 40>  

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


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

V

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

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