Skip to content

Instantly share code, notes, and snippets.

@Igosuki
Created November 21, 2019 10:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Igosuki/b9736831cd63855b07f57dda5fc63b53 to your computer and use it in GitHub Desktop.
Save Igosuki/b9736831cd63855b07f57dda5fc63b53 to your computer and use it in GitHub Desktop.
Reading NodeJS JSON encoded buffers in Python.
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'))
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