( file: NodeFile, format: ReadFormat, encoding?: BufferEncoding )
| 313 | } |
| 314 | |
| 315 | private readFile ( file: NodeFile, format: ReadFormat, encoding?: BufferEncoding ) { |
| 316 | this.file = file |
| 317 | this.format = format |
| 318 | this.encoding = encoding |
| 319 | |
| 320 | if ( !this.file || !this.file.name || !( this.file.path || this.file.stream || this.file.buffer ) ) { |
| 321 | throw new Error( `cannot read as File: ${ JSON.stringify( this.file ).slice( 0, 1000 ) }` ) |
| 322 | } |
| 323 | |
| 324 | if ( this.readyState !== this.EMPTY ) { |
| 325 | console.log( 'already loading, request to change format ignored' ) |
| 326 | return |
| 327 | } |
| 328 | |
| 329 | process.nextTick( () => { |
| 330 | this.readyState = this.LOADING |
| 331 | this.dispatchEvent( 'loadstart' ) |
| 332 | this.createFileStream() |
| 333 | this.mapStreamToEmitter() |
| 334 | this.registerUserEvents() |
| 335 | } ) |
| 336 | } |
| 337 | } |
no test coverage detected