Skip to main content

deleteFile

codebolt.fs.deleteFile(filename: string, filePath: string): Promise<DeleteFileResponse>
Deletes a file at the specified path.

Parameters

NameTypeDescription
filenamestringThe name of the file to delete.
filePathstringThe path of the file to delete.

Returns:

 Promise<DeleteFileResponse>
A promise that resolves with the server response.

Examples

Basic File Deletion

// Delete a file from a specific directory
const result = await codebolt.fs.deleteFile('example.txt', '/home/user/documents');
console.log('File deleted:', result);

Delete File from Current Directory

// Delete a file from the current working directory
const deleteResult = await codebolt.fs.deleteFile('fs-test-file.txt', '.');
console.log('✅ File deleted:', deleteResult);