Skip to content

FileOpsAPI

Defined in: namespaces.ts:131

getSelectedFiles(): Promise<PluginFileDescriptor[]>

Defined in: namespaces.ts:134

Returns file descriptors for the active pane’s selected files.

Promise<PluginFileDescriptor[]>


getActiveDirectory(): Promise<string>

Defined in: namespaces.ts:136

Returns the URL string of the active pane’s current directory.

Promise<string>


getPaneDirectory(paneId): Promise<string>

Defined in: namespaces.ts:138

Returns the URL string of the specified pane’s directory.

string

Promise<string>


listDirectory(url): Promise<PluginFileDescriptor[]>

Defined in: namespaces.ts:140

Lists directory contents.

string

Promise<PluginFileDescriptor[]>


getFileInfo(url): Promise<PluginFileDescriptor>

Defined in: namespaces.ts:142

Returns metadata for a single file.

string

Promise<PluginFileDescriptor>


readFile(url, encoding?): Promise<string>

Defined in: namespaces.ts:144

Reads a text file.

string

string

Promise<string>


readFileData(url): Promise<string>

Defined in: namespaces.ts:146

Reads a file as a base64-encoded string.

string

Promise<string>


copy(sources, dest): Promise<void>

Defined in: namespaces.ts:150

Copies files to a destination directory.

string[]

string

Promise<void>


move(sources, dest): Promise<void>

Defined in: namespaces.ts:152

Moves files to a destination directory.

string[]

string

Promise<void>


delete(urls, trash?): Promise<void>

Defined in: namespaces.ts:154

Deletes files.

string[]

boolean

Promise<void>


rename(url, newName): Promise<string>

Defined in: namespaces.ts:156

Renames a file. Returns the new URL string.

string

string

Promise<string>


createDirectory(parentUrl, name): Promise<string>

Defined in: namespaces.ts:158

Creates a new directory. Returns the URL string.

string

string

Promise<string>


createFile(parentUrl, name, contents?): Promise<string>

Defined in: namespaces.ts:160

Creates a new file with optional initial contents. Returns the URL string.

string

string

string

Promise<string>


writeFile(url, contents, encoding?): Promise<void>

Defined in: namespaces.ts:162

Writes text content to an existing file.

string

string

string

Promise<void>


batch(operations): Promise<BatchResult[]>

Defined in: namespaces.ts:164

Executes multiple file operations as a batch.

BatchOperation[]

Promise<BatchResult[]>


watchDirectory(url, handler): string

Defined in: namespaces.ts:168

Watches a directory for changes. Returns subscription ID.

string

(changedPaths) => void

string


watchDirectoryWithOptions(url, options, handler): string

Defined in: namespaces.ts:170

Watches a directory for changes with configurable debounce and recursion.

string

WatchOptions

(changedPaths) => void

string


unwatchDirectory(subscriptionId): void

Defined in: namespaces.ts:176

Cancels a directory watcher subscription.

string

void


onBeforeOperation(type, handler): string

Defined in: namespaces.ts:180

Registers a before-operation hook.

FileOperationType | FileOperationType[]

(event) => void | BeforeHookResult

string


onAfterOperation(type, handler): string

Defined in: namespaces.ts:185

Registers an after-operation hook.

FileOperationType | FileOperationType[]

(event) => void

string


removeBeforeHook(subscriptionId): void

Defined in: namespaces.ts:190

Removes a before-hook subscription.

string

void


removeAfterHook(subscriptionId): void

Defined in: namespaces.ts:192

Removes an after-hook subscription.

string

void