knex streams

Solutions on MaxInterview for knex streams by the best coders in the world

showing results for - "knex streams"
Elwyn
25 Apr 2016
1const stream = knex.select('*').from('users').stream();
2stream.on('data', function (row) {
3  console.log(row);
4})
5.on('error', function (error) {
6  console.log('error', error.message)
7})
8.on('end', function () {
9  console.log('end')
10})
11req.on('close', stream.close.bind(stream));  // manually close on request cancel
12// how can you stream to the socket?
13// how do you know when the amount is reached to end the response?
14});
queries leading to this page
knex streamknex streamsknex streams