缓冲区以字符串为字符串字符串
在node.js中,我将获得一个缓冲结果,例如:
< buffer 21 61 0b>
如何将其转换为这样的字符串:
“ 21610b”
所有方法我在网上看到的建议是将缓冲区转换为字符串,但这将改变布局。我想保留与字符串完全相同的布局。
In Node.js I am getting a buffer result as:
<Buffer 21 61 0b>
How can I convert this to a string like this:
“21610b”
All the methods and suggestions I have seen online are for converting the buffer to a string but that will change the layout. I want to keep the exact same layout as string.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
控制台通过在十六进制符号中显示前几个字节来概括缓冲对象。要将缓冲区转换为十六进制的字符串,请使用
.tostring('hex')
。The console summarizes Buffer objects by displaying the first few bytes in hexadecimal notation. To convert a Buffer to a string of hexadecimals, use
.toString('hex')
.