Skip to content

FileOpsAPI

Defined in: namespaces.ts:130

getSelectedFiles(): Promise<PluginFileDescriptor[]>

Defined in: namespaces.ts:133

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

Promise<PluginFileDescriptor[]>


getActiveDirectory(): Promise<string>

Defined in: namespaces.ts:135

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

Promise<string>


getPaneDirectory(paneId): Promise<string>

Defined in: namespaces.ts:137

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

string

Promise<string>


listDirectory(url): Promise<PluginFileDescriptor[]>

Defined in: namespaces.ts:139

Lists directory contents.

string

Promise<PluginFileDescriptor[]>


getFileInfo(url): Promise<PluginFileDescriptor>

Defined in: namespaces.ts:141

Returns metadata for a single file.

string

Promise<PluginFileDescriptor>


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

Defined in: namespaces.ts:143

Reads a text file.

string

string

Promise<string>


readFileData(url): Promise<string>

Defined in: namespaces.ts:145

Reads a file as a base64-encoded string.

string

Promise<string>


copy(sources, dest): Promise<void>

Defined in: namespaces.ts:149

Copies files to a destination directory.

string[]

string

Promise<void>


move(sources, dest): Promise<void>

Defined in: namespaces.ts:151

Moves files to a destination directory.

string[]

string

Promise<void>


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

Defined in: namespaces.ts:153

Deletes files.

string[]

boolean

Promise<void>


rename(url, newName): Promise<string>

Defined in: namespaces.ts:155

Renames a file. Returns the new URL string.

string

string

Promise<string>


createDirectory(parentUrl, name): Promise<string>

Defined in: namespaces.ts:157

Creates a new directory. Returns the URL string.

string

string

Promise<string>


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

Defined in: namespaces.ts:159

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:161

Writes text content to an existing file.

string

string

string

Promise<void>


batch(operations): Promise<BatchResult[]>

Defined in: namespaces.ts:163

Executes multiple file operations as a batch.

BatchOperation[]

Promise<BatchResult[]>


watchDirectory(url, handler): string

Defined in: namespaces.ts:167

Watches a directory for changes. Returns subscription ID.

string

(changedPaths) => void

string


watchDirectoryWithOptions(url, options, handler): string

Defined in: namespaces.ts:169

Watches a directory for changes with configurable debounce and recursion.

string

WatchOptions

(changedPaths) => void

string


unwatchDirectory(subscriptionId): void

Defined in: namespaces.ts:175

Cancels a directory watcher subscription.

string

void


onBeforeOperation(type, handler): string

Defined in: namespaces.ts:179

Registers a before-operation hook.

FileOperationType | FileOperationType[]

(event) => void | BeforeHookResult

string


onAfterOperation(type, handler): string

Defined in: namespaces.ts:184

Registers an after-operation hook.

FileOperationType | FileOperationType[]

(event) => void

string


removeBeforeHook(subscriptionId): void

Defined in: namespaces.ts:189

Removes a before-hook subscription.

string

void


removeAfterHook(subscriptionId): void

Defined in: namespaces.ts:191

Removes an after-hook subscription.

string

void