Edit text file USing CasperJs -
is possible read text file , replace character or strings , save in new file using casperjs? tried searching lot can find reading , writing data in text files...
my main aim fetch text , store in json file, problem getting \n
text.
i can fetch text , store in json file, remove \n
character, thought of opening file , replace "\n"
null
.
text fetched:
hello abc
i using these commands:
var = this.fetchtext({type: 'xpath', path: 'tr5'}); this.echo(json.stringify(a));
output:
hello\n abc
and don't want \n
character. want print "hello"
, "abc"
in same line.
expected:
hello abc
please me code.
so phantomjs has fs module capable of reading , writing. answer question yes casper uses fs module read , write. if need casper open file , read line line can that. casper javascript. if want parse file line line remove characters, add characters etc... of can done using casperjs.
Comments
Post a Comment