Node.js Buffer.writeUInt32BE() Method Last Updated : 13 Oct, 2021 Comments Improve Suggest changes Like Article Like Report The Buffer.writeUInt32BE() method is used to write a number to an instance of the Buffer class. This value is written at the specified offset and in the big endian format. Syntax: buffer.writeUInt32BE(value, offset) Parameters: This method accept two parameters as mentioned above and described below: Value: This parameter holds the number to write. It should be a valid unsigned 32 bit integer. Also, behavior is not defined for invalid value. Offset: This parameter holds the number of bytes to skip. The value must be in range [0, buffer.length - 4]. It is optional parameter and the default value is zero. Return value: This parameter returns the sum of number of bytes written and the offset. Example 1: javascript // Node.js program to demonstrate the // Buffer.writeUInt32BE method // Creating a buffer of size 8 const buffer = Buffer.allocUnsafe(8); console.log(buffer); // Return value is 4 buffer.writeUInt32BE(0xabcdabcd, 0); console.log(buffer); // Return value is 8 buffer.writeUInt32BE(0xabcdabcd, 4); console.log(buffer); Output: <Buffer 6c 69 63 65 00 00 00 00> <Buffer ab cd ab cd 00 00 00 00> <Buffer ab cd ab cd ab cd ab cd> Example 2: javascript // Node.js program to demonstrate the // Buffer.writeUInt32BE method // Creating a buffer of size 8 const buffer = Buffer.allocUnsafe(8); console.log(buffer); // Out of range error will be thrown buffer.writeUInt32BE(0xabcdabcd, 5); Output: <Buffer b0 f1 67 fc 63 7f 00 00> Thrown: RangeError [ERR_OUT_OF_RANGE] ........ Reference: https://nodejs.org/api/buffer.html#buffer_buf_readint32be_offset Create Quiz Comment D dev10kalra Follow 0 Improve D dev10kalra Follow 0 Improve Article Tags : Web Technologies Node.js Node.js-Buffer-module Explore Introduction & Installation NodeJS Introduction3 min readNode.js Roadmap: A Complete Guide6 min readHow to Install Node.js on Linux6 min readHow to Install Node.js on Windows5 min readHow to Install NodeJS on MacOS6 min readNode.js vs Browser - Top Differences That Every Developer Should Know6 min readNodeJS REPL (READ, EVAL, PRINT, LOOP)4 min readExplain V8 engine in Node.js7 min readNode.js Web Application Architecture3 min readNodeJS Event Loop5 min readNode.js Modules , Buffer & StreamsNodeJS Modules5 min readWhat are Buffers in Node.js ?4 min readNode.js Streams4 min readNode.js Asynchronous ProgrammingAsync Await in Node.js3 min readPromises in NodeJS7 min readHow to Handle Errors in Node.js ?4 min readException Handling in Node.js3 min readNode.js NPMNodeJS NPM6 min readSteps to Create and Publish NPM packages7 min readIntroduction to NPM scripts2 min readNode.js package.json4 min readWhat is package-lock.json ?3 min readNode.js Deployments & CommunicationNode Debugging2 min readHow to Perform Testing in Node.js ?2 min readUnit Testing of Node.js Application5 min readNODE_ENV Variables and How to Use Them ?2 min readDifference Between Development and Production in Node.js3 min readBest Security Practices in Node.js4 min readDeploying Node.js Applications5 min readHow to Build a Microservices Architecture with NodeJS3 min readNode.js with WebAssembly3 min readResources & ToolsNode.js Web Server6 min readNode Exercises, Practice Questions and Solutions4 min readNode.js Projects9 min readNodeJS Interview Questions and Answers15+ min read Like