【发布时间】:2020-01-29 09:38:45
【问题描述】:
我们在 Web 应用程序中使用 Node.js 编写文件时遇到问题。 Node.js 是使用 IISNode 安装的。
在我们的开发服务器上一切正常,但相同的代码在我们的生产服务器(Windows 7、IIS7、Windows Server 2008 R2 Standard、Service pack 1)上出现问题。 基本上,在单击按钮时,节点会创建多个 HTML 文件,并将内容写入其中。问题是内容没有写入所有创建的文件。所有文件都已创建,但有些文件留空,没有内容。
以下是用于创建和写入文件的代码摘录:
const $ = cheerio.load(cssData + videoHtml + pageData.content);
let indexFile = fs.openSync(file, 'w+')
fs.writeFileSync(indexFile, $.html(), { encoding: 'utf8' })
fs.closeSync(indexFile)
【问题讨论】:
标签: javascript node.js iis-7 windows-server-2008-r2