Skip to main content

createFile

codebolt.fs.createFile(fileName: string, source: string, filePath: string): 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.

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');