From 564874654654b3080a4e532a61c14946e76efa8d Mon Sep 17 00:00:00 2001 From: Onja Date: Tue, 10 Oct 2023 16:05:50 +0300 Subject: [PATCH] Add index and count to parse.data and parse.end events in File model --- src/models/file.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/models/file.js b/src/models/file.js index e775916..5a0122e 100644 --- a/src/models/file.js +++ b/src/models/file.js @@ -149,7 +149,7 @@ class File extends EventEmitter { }) .on('data', (row) => { // Emit a parse.data event with the url, filepath and data - this.emit('parse.data', { url: this.url, filepath: this.filepath, data: row }); + this.emit('parse.data', { url: this.url, filepath: this.filepath, data: row, index: i }); let result = []; if ( i === 0 ) { @@ -174,7 +174,7 @@ class File extends EventEmitter { }) .on('end', () => { // Emit a parse.end event with the url and filepath - this.emit('parse.end', { url: this.url, filepath: this.filepath }); + this.emit('parse.end', { url: this.url, filepath: this.filepath, count: i }); stream.end(); });