Asynchronously rename file at oldPath
to the pathname provided
as newPath
. In the case that newPath
already exists, it will
be overwritten. If there is a directory at newPath
, an error will
be raised instead. No arguments other than a possible exception are
given to the completion callback.
See also: rename(2)
.
import { rename } from 'fs';
rename('oldFile.txt', 'newFile.txt', (err) => {
if (err) throw err;
console.log('Rename complete!');
});
v0.0.67
Generated using TypeDoc
Asynchronously rename file at
oldPath
to the pathname provided asnewPath
. In the case thatnewPath
already exists, it will be overwritten. If there is a directory atnewPath
, an error will be raised instead. No arguments other than a possible exception are given to the completion callback.See also:
rename(2)
.Since
v0.0.67