writeToFile
codebolt.fs.writeToFile(relPath: string, newContent: string): Promise<WriteToFileResponse>
Writes content to a file at the specified path.
Parameters
Name | Type | Description |
---|---|---|
relPath | string | The relative path of the file to write to. |
newContent | string | The new content to write into the file. |
Returns:
Promise<WriteToFileResponse>
A promise that resolves with the write operation result.Example
// Let's assume you want to write content to a file named example.txt in the /home/user/documents directory.
codebolt.fs.writeToFile('/home/user/documents/example.txt', 'This is the new content.');