mic*_*hal 4 readfile node.js nestjs
我尝试使用方法获取文件readFileSync:
import fs from 'fs';
import path from 'path';
const templateFile = fs.readFileSync(
path.resolve(
__dirname,
'../mail/templates/exampleTemplate.html',
),
'utf-8',
);
Run Code Online (Sandbox Code Playgroud)
Nest 仍然返回错误:
类型错误:无法读取未定义的属性“readFileSync”
我尝试过 path: ./templates/exampleTemplate.html,但结果是一样的
我有一个结构文件:
| 归档时间: |
|
| 查看次数: |
950 次 |
| 最近记录: |