Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

file system replace line js

var fs = require('fs')
fs.readFile(someFile, 'utf8', function (err,data) {
  if (err) {
    return console.log(err);
  }
  var result = data.replace(/string to be replaced/g, 'replacement');

  fs.writeFile(someFile, result, 'utf8', function (err) {
     if (err) return console.log(err);
  });
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: js are you sure alert 
Javascript :: ng serve local network 
Javascript :: js check if string is base64 
Javascript :: jQuery.easing[this.easing] is not a function 
Javascript :: react native flatlist pull to refresh 
Javascript :: react native go to next text input 
Javascript :: mask date of birth/ dob in javascript 
Javascript :: js vanilla when i remove one object it removes all of them 
Javascript :: react router catch all 404 
Javascript :: js get difference in days 
Javascript :: javascript get child by name 
Javascript :: classlist has class 
Javascript :: javascript make element invisible 
Javascript :: round a number to fixed decimals 
Javascript :: adonis hook 
Javascript :: email validation in react js 
Javascript :: js sentence to array 
Javascript :: javascript loop through object example 
Javascript :: find in array of objects javascript 
Javascript :: node open file 
Javascript :: cube camera three js 
Javascript :: v-switch vuex store 
Javascript :: javascript remove all child elements 
Javascript :: jquery calc height based on width 
Javascript :: motify react native 
Javascript :: get last item in map javascript 
Javascript :: js to json 
Javascript :: js loop every x seconds 
Javascript :: backbone events 
Javascript :: how to stop iframe video using javascript 
ADD CONTENT
Topic
Content
Source link
Name
3+9 =