node.js - save file from array using fs without seperator -
i have problem save array file, don't way getting ',' separator in new file assuming means new row in array. example have file
this file text check i read file save array make modification , want save file.
fs.writefile('to_save', file.map(function(x){return x + '\n'})); when getting new file ,
,this file ,with text ,to check when try remove firs letter using
fs.writefile('to_save', file.map(function(x){return x = x.substring(1, x.length) + '\n'})); it remove me t, w , t, question how ride separator?
use join instead of map
fs.writefile('to_save', file.join("\n")); writefile expects string, buffer, or uint8array data. implicitly call tostring() on array, why you'll commas.
Comments
Post a Comment