Skip to main content

File API

File API

import { CodeBoltClient } from '@codebolt/clientsdk';

const client = new CodeBoltClient();

Quick Reference

MethodDescription
addFileCreates a new file in the workspace.
checkFileExistsChecks whether a file exists at the specified path.
deleteZipDeletes a previously created zip file.
zipFileCreates a zip archive from specified files or directories.

Methods


addFile

client.file.addFile(data: AddFileRequest): Promise<unknown>

Creates a new file in the workspace.

Adds a file with the specified name and content. If the file already exists, behavior depends on the server configuration.

ParameterTypeRequiredDescription
dataAddFileRequestYesRequest specifying the file path and content to create

Returns: Promise<unknown> — A promise that resolves when the file has been created

Full reference →


checkFileExists

client.file.checkFileExists(data: CheckFileExistsRequest): Promise<CheckFileExistsResponse>

Checks whether a file exists at the specified path.

Verifies file existence without reading its contents. Useful for conditional logic that depends on whether a file is already present.

ParameterTypeRequiredDescription
dataCheckFileExistsRequestYesRequest specifying the file path to check

Returns: Promise<CheckFileExistsResponse> — A promise that resolves to a indicating existence

Full reference →


deleteZip

client.file.deleteZip(data: DeleteZipRequest): Promise<unknown>

Deletes a previously created zip file.

Removes a zip archive from the workspace filesystem. Use this to clean up temporary archives after they have been downloaded or processed.

ParameterTypeRequiredDescription
dataDeleteZipRequestYesRequest specifying the zip file path to delete

Returns: Promise<unknown> — A promise that resolves when the zip file has been deleted

Full reference →


zipFile

client.file.zipFile(data: ZipFileRequest): Promise<unknown>

Creates a zip archive from specified files or directories.

Compresses the specified sources into a zip file at the given output path. Useful for bundling project files for download or deployment.

ParameterTypeRequiredDescription
dataZipFileRequestYesRequest specifying source paths and the output zip file location

Returns: Promise<unknown> — A promise that resolves when the zip file has been created

Full reference →