logo
Search
showing results for - "file system replace line js"
Iliana
10 Jun 2020
1var fs = require('fs')
2fs.readFile(someFile, 'utf8', function (err,data) {
3  if (err) {
4    return console.log(err);
5  }
6  var result = data.replace(/string to be replaced/g, 'replacement');
7
8  fs.writeFile(someFile, result, 'utf8', function (err) {
9     if (err) return console.log(err);
10  });
11});
similar questions
replace comma by new line in jsprint to console without newline nodejsjavascript replace character globallynew line with javascript writereplaceall alternative with string value javascriptjavascript replace newlinereplace file content node javascriptjavascript replace 5cnstr replace javascript allreplace each string by another string javascriptlocation replace jsfind and replace it in a string javascriptjavascript replace without replace 28 29replacing characters in string javascripthow to get a particular line from a file in nodejs
queries leading to this page
file system replace line jstypescript file replace linejs replace regex in filenode sync replace string in filenode js replace file contentchange specific line in a file nodejsreplace text of javascript file using javascriptnodejs find string and replace in filefile system replace line js
privacy policyterms of useinstagram
Crafted with  ♥  for everyone

sign in to continue
your answer for
you will get a confirmation link on this - you will have to click that for successful submission of your answer. we require this to keep the website free of spam, bots and unhelpful content
please ensure to add code which is syntactically corrent and executes properly
sign in to continue
ask question on maxinterview
you will get a confirmation link on this - you will have to click that for successful submission of your question. we require this to keep the website free of spam, bots and unhelpful content
please be clear, to the point and respectful
sign in to continue