Skip to content

@vtj


@vtj / node / moveSync

Variable: moveSync() ​

const moveSync: (src, dest, options?) => void = fs.moveSync

Defined in: packages/node/src/fs.ts:23

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 })