import { Writable } from 'stream' ; export default class SingleObjectWritableStream < T > extends Writable { private o : T = null ; constructor ( ) { super ( { objectMode : true } ) ; } get object ( ) : T { return this . o ; } _write ( object , encoding , callback ) { if ( this . o ) { return callback ( new Error ( `Can only write one object to SingleObjectWritable` ) ) ; } this . o = object ; callback ( ) ; } }