UseCopyFile
katanakit-js / useCopyFile
Function: useCopyFile()
Section titled “Function: useCopyFile()”function useCopyFile( source, destination, options?,): Promise<FilesystemResult<string>>;Defined in: infrastructure/filesystem/filesystem.service.ts:432
Copies a file. Existing destinations are overwritten unless
overwrite: false is passed (COPYFILE_EXCL).
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
source |
string |
Source file path. |
destination |
string |
Destination file path. |
options? |
{ overwrite?: boolean; } |
Set overwrite: false to fail when the target exists. |
options.overwrite? |
boolean |
- |
Returns
Section titled “Returns”Promise<FilesystemResult<string>>
Safe Result with the destination path.
Example
Section titled “Example”await useCopyFile("data/books.json", "backup/books.json");