Skip to main content

updateFile

codebolt.fs.updateFile(filename: string, filePath: string, newContent: string): Promise<UpdateFileResponse>
Updates the content of a file at the specified path.

Parameters

NameTypeDescription
filenamestringThe name of the file to update.
filePathstringThe path of the file to update.
newContentstringThe new content to write into the file.

Returns:

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

Example

// Let's assume you want to update the content of a file named example.txt in the /home/user/documents directory.

codebolt.fs.updateFile('example.txt', '/home/user/documents', 'This is the updated content.');