# How can I convert a buffer \[4\] into a number value?

**URL:** https://discourse.nodered.org/t/how-can-i-convert-a-buffer-4-into-a-number-value/3506
**Category:** General
**Created:** [27 September 2018 16:10 UTC](https://discourse.nodered.org/t/how-can-i-convert-a-buffer-4-into-a-number-value/3506 "2018-09-27T16:10:57Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![shrickus](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/shrickus/32/517_2.png) [@shrickus](https://discourse.nodered.org/u/shrickus)
#### Post date: [27 September 2018 18:06 UTC](https://discourse.nodered.org/t/how-can-i-convert-a-buffer-4-into-a-number-value/3506/2 "2018-09-27T18:06:55Z")

</div>

Here is a nice reference for [reading/writing buffers](https://www.w3schools.com/nodejs/ref_buffer.asp) on the W3Schools site.

For instance, if you just want to replace the 4-byte payload buffer with its 32-bit signed  
big-endian integer value, try this:

```auto
msg.payload = msg.payload.readInt32BE();
return msg;

```

---

_[View the full topic](https://discourse.nodered.org/t/how-can-i-convert-a-buffer-4-into-a-number-value/3506)._
