diff --git a/src/subscribers/consoleSubscriber.js b/src/subscribers/consoleSubscriber.js new file mode 100644 index 0000000..930de63 --- /dev/null +++ b/src/subscribers/consoleSubscriber.js @@ -0,0 +1,64 @@ +const emitter = require('../services/eventEmitter'); + +// Create a new listener for the download.start event +emitter.on('download.start', ({ url, filepath }) => { + console.log(`Downloading ${url} to ${filepath}`); +}); + +// Create a new listener for the download.end event +emitter.on('download.end', ({ url, filepath }) => { + console.log(`Downloaded ${url} to ${filepath}`); +}); + +// Create a new listener for the download.error event +emitter.on('download.error', ({ url, filepath, error, type }) => { + console.error(`Error [${type}] downloading ${url} to ${filepath}: ${error}`); +}); + +// Create a new listener for the download.progress event +emitter.on('download.progress', ({ url, filepath, percentage }) => { + console.log(`Downloaded ${percentage}% of ${url} to ${filepath}`); +}); + + + + + +// Create a new listener for the parseFromUrl.start event +emitter.on('parseFromUrl.start', ({ url, columns }) => { + console.log(`Parsing ${url} with columns [${columns.join(', ')}]`); +}); + +// Create a new listener for the parseFromUrl.end event +emitter.on('parseFromUrl.end', ({ url, columns, filepath }) => { + console.log(`Parsed ${url} with columns ${columns.join(', ')} to ${filepath}`); +}); + +// Create a new listener for the parseFromUrl.error event +emitter.on('parseFromUrl.error', ({ url, columns, error }) => { + console.error(`Error parsing ${url} with columns ${columns.join(', ')}: ${error}`); +}); + + + + + +// Create a new listener for the parse start event +emitter.on('parse.start', ({ filepath, columns, headers }) => { + console.log(`Parsing ${filepath} with columns ${columns.join(', ')} and headers ${headers.join(', ')}`); +}); + +// Create a new listener for the parse.end event +emitter.on('parse.end', ({ filepath, columns, count }) => { + console.log(`Parsed ${filepath} with columns ${columns.join(', ')} and ${count} rows`); +}); + +// Create a new listener for the parse.error event +emitter.on('parse.error', ({ filepath, columns, error }) => { + console.error(`Error parsing ${filepath} with columns ${columns.join(', ')}: ${error}`); +}); + +// Create a new listener for the parse.data event +emitter.on('parse.data', ({ filepath, columns, data, index }) => { + console.log(`Parsed ${filepath} with columns ${columns.join(', ')} at index ${index}`); +}); \ No newline at end of file