Guilherme Reda
Guilherme Reda

Reputation: 115

NODEJS Create zip from byte string

I have to make a POST request to a server that returns me this. enter image description here

And I have to write a ZIP from that, how do I get the bytes from that string to generate my zip file?

Upvotes: 1

Views: 2728

Answers (1)

Diwakar Sinha
Diwakar Sinha

Reputation: 25

you just need to create a buffer from the api response and create a zip file using that buffer.

var fs = require('fs');
var buff = new Buffer(response_from_api);
fs.writeFile("./test1.zip", buff, function(err){
    //do something
});

Upvotes: 3

Related Questions