I need to send large csv file from node to python. this code is working for small file but not for large files. i have tried spawn process too. i am not understanding whats the problem. if anyone knows the correct code do share
Code:
const express=require('express')
const app=express()
let p = require('python-shell');
const fs = require('fs');
let filledarray=[]
fs.createReadStream('data.csv')
.pipe(csv())
.on('data', (row) => {
filledarray.push(row)
})
.on('end', () => {
console.log('CSV file successfully processed');
});
app.get('/send',(req,res)=>{
var options = {
args:
[
JSON.stringify(filledarray)
]
}
p.PythonShell.run('hello.py', options, function (err, results) {
if(err) {
console.error(err)
}
else{
console.log(results)
res.send(results)
}
});
})
app.listen('5000')
Error
Error: spawn ENAMETOOLONG at ChildProcess.spawn (internal/child_process.js:394:11) at Object.spawn
(child_process.js:535:9)