readFile
codebolt.fs.readFile(filePath: string): Promise<ReadFileResponse>
Reads the content of a file from the specified path.
Parameters
Name | Type | Description |
---|---|---|
filePath | string | The path of the file to read. |
Returns:
Promise<ReadFileResponse>
A promise that resolves with the server response.Examples
Basic File Reading
// Read a file from absolute path
const content = await codebolt.fs.readFile('/home/user/documents/example.txt');
console.log('File content:', content);
Reading Files from Current Directory
// Read a file from current directory using relative path
const readResult = await codebolt.fs.readFile('./fs-test-file.txt');
console.log('✅ File read:', readResult);