A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/sindresorhus/copy-file below:

GitHub - sindresorhus/copy-file: Copy a file

Copy a file

import {copyFile} from 'copy-file';

await copyFile('source/unicorn.png', 'destination/unicorn.png');
console.log('File copied');
copyFile(source, destination, options?)

Returns a Promise that resolves when the file is copied.

The file is cloned if the onProgress option is not passed and the file system supports it.

copyFileSync(source, destination, options?)

Type: string

The file you want to copy.

The file is cloned if the file system supports it.

Type: string

Where you want the file copied.

Type: object

Type: boolean
Default: true

Overwrite existing destination file.

Type: string
Default: process.cwd()

The working directory to find source files.

The source and destination path are relative to this.

Type: number
Default: 0o777

Permissions for created directories.

It has no effect on Windows.

Type: (progress: ProgressData) => void

The given function is called whenever there is measurable progress.

Only available when using the async method.

{
	sourcePath: string,
	destinationPath: string,
	size: number,
	writtenBytes: number,
	percent: number
}
import {copyFile} from 'copy-file';

await copyFile(source, destination, {
	onProgress: progress => {
		// …
	}
});

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4