Skip to content

@vtj


@vtj / node / moveSync

Function: moveSync()

moveSync(src, dest, options?): void

Moves a file or directory, even across devices.

Parameters

src

string

dest

string

Note: When src is a file, dest must be a file and when src is a directory, dest must be a directory.

options?

MoveOptions

Returns

void

Example

ts
import * as fs from 'fs-extra'

fs.moveSync('/tmp/somefile', '/tmp/does/not/exist/yet/somefile')

// Using `overwrite` option
fs.moveSync('/tmp/somedir', '/tmp/may/already/exist/somedir', { overwrite: true })

Defined in

packages/node/src/fs.ts:23

Released under the MIT License.