fs.rename
fs.rename
Function
Rename the current path to the target path.
Syntax
fs(path).rename(to)
Parameters
| Parameters | Type | Required | Default value | Description |
|---|---|---|---|---|
| to | String | Yes | None | The destination path. |
Return value
| Type | Description |
|---|---|
| Fs | Returns the fs object bound to the new path. |
Example
file = fs('docs-old.txt') file.write('BT') result = file.rename('docs-new.txt') // Output: Fs echo(type(result))
Notes
- This method moves or renames the underlying file system path.