Created
November 21, 2019 10:18
-
-
Save Igosuki/b9736831cd63855b07f57dda5fc63b53 to your computer and use it in GitHub Desktop.
Reading NodeJS JSON encoded buffers in Python.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const j = '{"type":"Buffer","data":[93,204,151,170,0,0,194,155,10,119,139,1,10,13,41,43]}' | |
const buffer = Buffer.from(JSON.parse(j).data) | |
console.log(typeof buffer); | |
console.log('str' + buffer.toString('hex')) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import binascii | |
a = bytearray([93,204,151,170,0,0,194,155,10,119,139,1,10,13,41,43]) | |
print(binascii.hexlify(bytearray(a))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment