(tree: Tree, filePath: string)
| 10 | |
| 11 | /** Gets the content of a specified file from a schematic tree. */ |
| 12 | export function getFileContent(tree: Tree, filePath: string): string { |
| 13 | const contentBuffer = tree.read(filePath); |
| 14 | |
| 15 | if (!contentBuffer) { |
| 16 | throw new Error(`Cannot read "${filePath}" because it does not exist.`); |
| 17 | } |
| 18 | |
| 19 | return contentBuffer.toString(); |
| 20 | } |