Skip to content
Advertisement

Create csv and post as multipart/form-data in JavaScript

How can I create an equivalent code in JavaScript?

Given [‘col1’, ‘col2’] and [‘val1’, ‘val2’] OR ‘col1,col2rnval1,val2rn’

I want to be able to create a csv object without reading/writing to disk and then POST it.

Python:

JavaScript

Here is my code in JavaScript so far:

JavaScript

EDIT:

I was able to send a csv file but had to write it to a disk first. Is it possible to avoid it?

JavaScript

Advertisement

Answer

I was able to solve my question with the following script:

JavaScript
Advertisement