我有一个 Firebase 函数,想要读取一个存储在子文件夹中的 html 文件。
\n\xe2\x94\x80\xe2\x94\x80 functions\n \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 src\n | \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 index.ts // Here is the function\n | \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 html\n | | \xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 template.html // the file I want to read\nRun Code Online (Sandbox Code Playgroud)\n我尝试通过读取文件, const html = fs.readFileSync('./html/template.html');但它总是告诉我
\n\n错误:ENOENT:没有这样的文件或目录,打开 './html/template.html'\nat Object.openSync
\n
我解决了 stackoverflow 上与这个主题相关的几乎所有问题,但没有任何效果对我有用。我还尝试将文件放在与函数相同的文件夹中,但它总是给我错误。
\n我是否需要安装某些软件包或以某种方式导入文件才能访问它?
\nfile firebase typescript google-cloud-platform google-cloud-functions