I am working with crypto library to send a POST request to update some data and for some reason I get as if I used JSON.parse(JSON.stringify(myBufferData)) to a Buffer data. I want to recover the original data.
How you can replicate my situation:
var buf = Buffer.from('abc'); var parsedBuf = JSON.parse(JSON.stringify(buf)); -> I faced with this result at some point. buf.toString() -> Give the expected result ('abc'). parsedBuf.toString() -> Doesn't retrieve original data ('[object Object]'). How can I retrieve the original data from parsedBuf ?
没有评论:
发表评论