-
-
Notifications
You must be signed in to change notification settings - Fork 639
Open
Labels
mysqljs/mysql incompatibilitiesPreviously: feligxe-mysql-incompatibilitiesPreviously: feligxe-mysql-incompatibilitiesquestion
Description
as title, how to correctly interrupt stream results?
In mysqljs, I call .end()
. that will trigger end event, then close stream
but in mysql2, TypeError: query.end is not a function
here is my code sample
// getConnection from pool
const query = conn.query('SELECT * FROM `table`')
.on('result', (aRow)=>{
// I handle one row and response to client, but if data is error or client disconnect, I need to stop res.
// thus, i call query.end();
})
.on('end', ()=>{
conn.release();
});
I'm curiosity, query is readable stream or the other? but readable stream should not have end() method
should I call destroy()
or close()
preferable ?
Metadata
Metadata
Assignees
Labels
mysqljs/mysql incompatibilitiesPreviously: feligxe-mysql-incompatibilitiesPreviously: feligxe-mysql-incompatibilitiesquestion