Node.js convert hexadecimal number to byteArray

前端 未结 2 466
醉话见心
醉话见心 2020-12-24 05:01

I want to send a raw buffer using bluetooth connection. The content is a hex number. Currently I split the number manually to an byte array. Is there any function that can h

相关标签:
2条回答
  • 2020-12-24 05:20

    In new versions of node (6+) the new Buffer() interface is deprecated. Use:

    Buffer.from("250001000192CD0000002F6D6E742F72", "hex")
    

    instead.

    Find more info on this using this link below https://nodejs.org/api/buffer.html#buffer_static_method_buffer_from_string_encoding

    0 讨论(0)
  • 2020-12-24 05:36
    new Buffer("250001000192CD0000002F6D6E742F72", "hex")
    
    0 讨论(0)
提交回复
热议问题