import { Client , types } from 'cassandra-driver' ; param client param query param rowCb export function streamAllResults < T > ( client , query , params , rowCb ) { return new Promise ( ( resolve , reject ) => { const allRows = new Array < T > ( ) ; let isError = false ; client . stream ( query , params , { fetchSize : 100 , } ) . on ( 'readable' , function ( this ) { let row ; while ( ( row = this . read ( ) ) ) { allRows . push ( rowCb ( row ) ) ; } } ) . on ( 'error' , ( err ) => { isError = true ; reject ( err ) ; } ) . on ( 'end' , ( ) => { if ( ! isError ) { resolve ( allRows ) ; } } ) ; } ) ; }