fs.renameSync(oldPath,
newPath)
This
method is used to rename a file synchronously.
Below
table summarizes the arguments of ‘renameSync’ method.
Argument
|
Type
|
Description
|
oldPath
|
string
or Buffer or URL
|
Current
name or path of the file
|
newPath
|
string
or Buffer or URL
|
New
name or path of the file
|
var fs = require('fs'); var oldPath = 'input.txt'; // Assume input.txt file is already exist. var newPath = 'output.txt'; fs.renameSync(oldPath, newPath)
No comments:
Post a Comment