Skip to main content

writeToFile

codebolt.fs.writeToFile(filePath: string, content: string): Promise<WriteToFileResponse>
Creates or updates a file and writes data to it.

Parameters

NameTypeDescription
filePathstringThe path where the file should be created or updated.
contentstringThe content to write into the file.

Returns:

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

Example



let { success, result } = await codebolt.fs.readFile(path);

Explaination

The codebolt.fs.writeToFile method is used to create a new file or update in a specified pah, with content provided as a string.

returns success and result. as output.