我正在尝试下载一个小的csv文件,并需要在处理之前将其存储到变量中:
var http = require('http');
var csvData;
var request = http.get('http://url', function(response) {
response.pipe(csvData);
});
request.end();
response.pipe()
只适用于文件流,我该如何将响应存储到 csvData
变量中?
csvData
is a string, OP asked to download the file in aBuffer
- Yves M.