我如何写一个流到csv文件 - node.js

时间:2016-02-04 07:28:32

标签: node.js csv fs

  request.post({url: "https://api.flipkart.com/listing/downloadListings",form: formDataListings}, function(e,r,body){
    var fs = require('fs');
    var writeStream = fs.createWriteStream('download.csv');
    body.pipe(writeStream);
  })

我想存储csv流并下载csv文件

enter image description here

1 个答案:

答案 0 :(得分:1)

当您pipe()时,请勿使用回调:

request.post({
  url: "https://api.flipkart.com/listing/downloadListings",
  form: formDataListings
}).pipe(fs.createWriteStream('download.csv'));