From 884b374d4ff6c0a8309c4c29930cb0945254888f Mon Sep 17 00:00:00 2001 From: Shalitha Suranga Date: Mon, 22 Apr 2024 17:16:26 +0530 Subject: [PATCH] Add options for the filesystem.copy function --- src/api/filesystem.ts | 5 +++-- src/types/api/filesystem.ts | 8 +++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/api/filesystem.ts b/src/api/filesystem.ts index 66eb9ee..f08f8ba 100644 --- a/src/api/filesystem.ts +++ b/src/api/filesystem.ts @@ -4,6 +4,7 @@ import type { DirectoryEntry, DirectoryReaderOptions, FileReaderOptions, + CopyOptions, OpenedFile, Stats, Watcher @@ -83,8 +84,8 @@ export function readDirectory(path: string, options?: DirectoryReaderOptions): P return sendMessage('filesystem.readDirectory', { path, ...options }); }; -export function copy(source: string, destination: string): Promise { - return sendMessage('filesystem.copy', { source, destination } ); +export function copy(source: string, destination: string, options?: CopyOptions ): Promise { + return sendMessage('filesystem.copy', { source, destination, ...options } ); }; export function move(source: string, destination: string): Promise { diff --git a/src/types/api/filesystem.ts b/src/types/api/filesystem.ts index edfb95f..f68e112 100644 --- a/src/types/api/filesystem.ts +++ b/src/types/api/filesystem.ts @@ -31,4 +31,10 @@ export interface Stats { export interface Watcher { id: number; path: string; -} \ No newline at end of file +} + +export interface CopyOptions { + recursive: boolean; + overwrite: boolean; + skip: boolean; +}