javascript - the right way of passing large variable from child process to parent process -


i trying pipe large array child process parent process. 200,000 * 100 * 2 number of elements in array. possibly need pass greater value in future.

the below child process passing array parent process

process.on('message', (msg) => {     // console.log('inside child class');     excelparsertool(msg).then((result)=>{         process.stdout.write(json.stringify(result));         process.exit();     }) }); 

result large array sends parent process

the below parent process receives array , processes it.

excelparserchild.stdout.on('data', (data) => {     excelbuffer += data });  excelparserchild.stderr.on('data', (error) => {     console.log('stderr');     console.log(error);     errorfinal += error;     console.log(errorfinal) }); excelparserchild.on('close', (exitcode) => {    console.log(excelbuffer);  }) 

this causes

(node:1468) unhandledpromiserejectionwarning: unhandled promise rejection (rejection id: 1): rangeerror: invalid string length (node:1468) [dep0018] deprecationwarning: unhandled promise rejections deprecated. in future, promise rejections not handled terminate node.js process non-zero exit code 

i have tried using process.send(result) try send array causes same error. wondering if correct way of passing large data child parent process. best methodology of passing large variable child process parent process? if doing right, how solve invalid string length issue? thanks.


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -