Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

node rename

const fs = require('fs')

oldPath = './wiki/old.txt'
newPath = './wiki/new.txt'

// Sync
fs.renameSync(oldPath, newPath)

// Async
fs.rename(oldPath, newPath, (error) => {
  if (error) { console.log(error) }
  else { /* Success! Now do something else. */ }
})
 
PREVIOUS NEXT
Tagged: #node #rename
ADD COMMENT
Topic
Name
5+1 =