Browse Source

Add index and count to parse.data and parse.end events in File model

node16
Onja 12 months ago
parent
commit
5648746546
  1. 4
      src/models/file.js

4
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();
});

Loading…
Cancel
Save