knex streams
const stream = knex.select('*').from('users').stream();
stream.on('data', function (row) {
console.log(row);
})
.on('error', function (error) {
console.log('error', error.message)
})
.on('end', function () {
console.log('end')
})
req.on('close', stream.close.bind(stream)); // manually close on request cancel
// how can you stream to the socket?
// how do you know when the amount is reached to end the response?
});