【发布时间】:2015-05-03 18:36:31
【问题描述】:
以下是搜索交易的braintree api。结果作为流接收。但无法以字符串或所需格式读取接收到的块。
var stream = gateway.transaction.search(function (search) {
result = search.paymentMethodToken().is("h337xg");
});
completeData = ""
stream.on("data", function(chunk){
// read the chunk
completeData += chunk;
});
stream.on("end", function(){
// print the output in console
console.log(completeData);
});
stream.resume();
可以在控制台中看到的输出如下: [对象对象][对象对象][对象对象][对象对象][对象对象][对象对象][对象对象]
【问题讨论】:
-
你试过 console.log(JSON.stringify(chunk)) 吗?它可能是 JSON 而不是字符串
标签: node.js braintree chunking