Long story short, I read a file with a file reading API then sliced readable data into chunks and send them to reassemble by another function to avoid reading large amount of data.
Part of the code would look like this:
var data = '';
request.on('data', (chunk) => {
data += chunk;
}).on('end', () => {
// do something with the data
});
Code (markup):
var data = [];
request.on('data', (chunk) => {
data.push(chunk);...
Code (markup):
from JavaScript https://ift.tt/37bJTqz
via IFTTT
0 Comments