(filename: fs.PathLike, options: string | any = null, cb: (line: string, err?: any) => boolean = null)
| 839 | } |
| 840 | |
| 841 | public startWithFile(filename: fs.PathLike, options: string | any = null, cb: (line: string, err?: any) => boolean = null): Promise<boolean> { |
| 842 | if (this.promise) { throw new Error('SpawnLineReader: can\'t reuse this object'); } |
| 843 | this.callback = cb; |
| 844 | this.promise = new Promise<boolean>((resolve) => { |
| 845 | const readStream = fs.createReadStream(filename, options || {flags: 'r'}); |
| 846 | readStream.on('error', ((e) => { |
| 847 | this.emit('error', e); |
| 848 | resolve(false); |
| 849 | })); |
| 850 | readStream.on('open', (() => { |
| 851 | this.doReadline(readStream, resolve); |
| 852 | })); |
| 853 | }); |
| 854 | return this.promise; |
| 855 | } |
| 856 | |
| 857 | private doReadline(rStream: stream.Readable, resolve) { |
| 858 | try { |
nothing calls this directly
no test coverage detected