javascript - Sails.js stream sql query -
is there way stream data model.query()
in sails ?
example
export: (req, res) => { let sql = "select ..."; let stream = model.query(sql).stream(); // know not work stream.pipe(...); }
yes. according sails doc:
module.exports = { teststream: function(req, res){ if (req.param('startstream') && req.issocket){ var getsocket = req.socket; // start stream. pipe sockets. user.stream({name:'walter'}).pipe(getsocket.emit); } else { res.view(); } } }
Comments
Post a Comment