Write a file into the session's working directory.
(relativePath: string, content: string)
| 60 | |
| 61 | /** Write a file into the session's working directory. */ |
| 62 | writeFile(relativePath: string, content: string): void { |
| 63 | const filePath = path.join(this.workDir, relativePath) |
| 64 | const dir = path.dirname(filePath) |
| 65 | if (!fs.existsSync(dir)) { |
| 66 | fs.mkdirSync(dir, { recursive: true }) |
| 67 | } |
| 68 | fs.writeFileSync(filePath, content, 'utf-8') |
| 69 | } |
| 70 | |
| 71 | /** Read a file from the session's working directory. */ |
| 72 | readFile(relativePath: string): string { |
no outgoing calls