question

EmmanuelSantiagoMagicLog-8117 avatar image
0 Votes"
EmmanuelSantiagoMagicLog-8117 asked SaurabhSharma-msft commented

How to convert contentBytes to file csv with node js

Hi I use graph api to get csv attachment, but when I obtain the response is in base64, when I decode the contentByte does not access from json or readable from fs.

which is the correct way to decode contentByte?

azure-ad-graph
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@EmmanuelSantiagoMagicLog-8117Have you tried using Buffer object in node js to convert base64 to string.
For example :
let csvBuffer = new Buffer(csvData, 'base64');
let csvText = csvBuffer.toString('ascii');


Please refer to the documentation to know more about character encoding using buffer object.




0 Votes 0 ·

@EmmanuelSantiagoMagicLog-8117 please let me know if this works for you.

(Please don't forget to accept helpful replies as answer)

0 Votes 0 ·

0 Answers