Categories
JavaScript Answers

How to display Node.js raw Buffer data as Hex string?

Spread the love

Sometimes, we want to display Node.js raw Buffer data as Hex string.

In this article, we’ll look at how to display Node.js raw Buffer data as Hex string.

How to display Node.js raw Buffer data as Hex string?

To display Node.js raw Buffer data as Hex string, we can use the buffer toString method.

For instance, we write

buff.toString('hex');

to convert the buff buffer to a string with toString.

We call toString with 'hex' to return a hex version of the raw buffer data.

Conclusion

To display Node.js raw Buffer data as Hex string, we can use the buffer toString method.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *