Skip to content
0

katanakit-js / useCopyFile

Function: useCopyFile() ​

ts
function useCopyFile(
   source, 
   destination, 
   options?
): Promise<FilesystemResult<string>>;

Defined in: src/infrastructure/filesystem/filesystem.service.ts:432

Copies a file. Existing destinations are overwritten unless overwrite: false is passed (COPYFILE_EXCL).

Parameters ​

ParameterTypeDescription
sourcestringSource file path.
destinationstringDestination file path.
options?{ overwrite?: boolean; }Set overwrite: false to fail when the target exists.
options.overwrite?boolean-

Returns ​

Promise<FilesystemResult<string>>

Safe Result with the destination path.

Example ​

ts
await useCopyFile("data/books.json", "backup/books.json");

Released under the MIT License.