Skip to main content

createFile

codebolt.fs.createFile(fileName: string, source: string, filePath: string): Promise<CreateFileResponse>
Creates a new file with the specified content at the given path.

Parameters

NameTypeDescription
fileNamestringThe name of the file to create.
sourcestringThe source content to write into the file.
filePathstringThe path where the file should be created.

Returns:

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

Example

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

codebolt.fs.createFile('example.txt', 'This is the content of the file.', '/home/user/documents');