D
D
dake12312016-02-24 07:07:58
JavaScript
dake1231, 2016-02-24 07:07:58

What is the correct way to write to casperjs file?

Hello, I want to write the results of parsing to a text file, then import the data into the database. But I ran into a problem, he writes each entry to a new line, for example:

data1;
data2;
data3; 

data1; 
data2;
data3;

and I would like it to be like this:
data1;data2;data3
data1;data2;data3

I write like this:
var content = data.data1 + ";" + data.data2 + ";" + data.data3 + "\n";
fs.write('myfile.txt', content, 'a')

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question