I have to add a new cell in each row. let's say I have a list of products CSV and I am fetching the image URL for each product it using some functionality and I need to update the URL corresponding to each product.
const writestream = fs.createWriteStream('src/working_file.csv', {
flags: 'a'
});
writestream.write({ image: imageURL });
the "image" is the new column name I want in my CSV file. "imageURL" is the URL of the produc I have in my hand
the above code is giving TypeError: Invalid non-string/buffer chunk
I got to read the CSV also for some reasons and I am using csv-parser for it.
You need to add the
imageURL
as a string, not an object containing theimageURL
. You might need to append a comma as well to separate it from the other columns, depending on the format of your file: