'use strict'; import { Readable } from 'stream'; import { CucumberMessage } from 'json-html-reporter-models'; export class StreamFunctions { public streamToArrayAsync( stream: Readable ): Promise<CucumberMessage[]> { return new Promise( ( resolve, reject ) => { const items: CucumberMessage[] = []; stream.on( 'data', items.push.bind( items ) ); stream.on( 'error', reject ); stream.on( 'end', () => resolve( items ) ); } ); } }