gpt4 book ai didi

node.js - Node.js 的缓冲区检查工具

转载 作者:搜寻专家 更新时间:2023-11-01 00:25:53 24 4
gpt4 key购买 nike

你知道有什么好的 Node.js 缓冲区检查库吗?打印出 Buffer 及其 utf8 内容将非常有用。示例:

Byte | HEX | UTF-8 | Name
-----+-----+-------+-----------
0 | 48 | H | UPPER H
1 | 65 | e | LOWER E
2 | 6c | l | LOWER L
3 | 6c | l | LOWER L
4 | 6f | o | LOWER O
5 | 20 | | WHITESPACE
6 | 57 | W | UPPER W
7 | 6f | o | LOWER O
8 | 72 | r | LOWER R
9 | 6c | l | LOWER L
10 | 64 | d | LOWER D

最佳答案

昨天我制作了一个名为 hex 的简单模块.这就像 hxd 程序。无需配置,易于使用,用于调试目的。

var hex = require("hex");
hex(buffer);

输出:

Offset   00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F

000000 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
000010 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
000020 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
000030 FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ
000040 54 41 47 42 72 65 61 6B 69 6E 67 20 54 68 65 20 TAGBreaking The
000050 4C 61 77 00 00 00 00 00 00 00 00 00 00 00 00 00 Law.............
000060 00 4A 75 64 61 73 20 50 72 69 65 73 74 00 00 00 .Judas Priest...
000070 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 42 ...............B
000080 72 69 74 69 73 68 20 53 74 65 65 6C 00 00 00 00 ritish Steel....
000090 00 00 00 00 00 00 00 00 00 00 00 00 00 31 39 38 .............198
0000A0 30 47 72 65 61 74 20 73 6F 6E 67 21 00 00 00 00 0Great song!....
0000B0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 33 89 ..............3.

关于node.js - Node.js 的缓冲区检查工具,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17829851/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com