Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const StreamArray = require('stream-json/streamers/StreamArray');
- const path = require('path');
- const fs = require('fs');
- const jsonStream = StreamArray.withParser();
- // 1-> get JOB ID from cmd args
- // 2 -> get filename/path from table for given hob ID.
- //
- //You'll get json objects here
- //Key is an array-index here
- var start = new Date()
- jsonStream.on('data', ({ key, value }) => {
- console.log(key, value);
- });
- jsonStream.on('end', () => {
- console.log('All done');
- // 1-> UPdate job status for as success for given JOb id
- });
- // const data_dir = "c://"
- //if JOB failed mark job as failed for given job ID.
- const filename = path.join(__dirname, 'temp.json');
- fs.createReadStream(filename).pipe(jsonStream.input);
- var end = new Date() - start
- console.info('Execution time: %dms', end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement