javascript - 使用容器中的 fs.writefile 写入已安装的 DFS 时出错
问题描述
我正在使用fs.writeFile
. 99% 的时间writefile
可以正常工作,但有时会返回错误。在代码中,我创建了文件并且不再访问它。也没有其他东西可以访问该文件。
try {
result = await this.writeFile(location, fileContent);
this.logger.info('File got released successfully');
} catch (error) {
.....
}
async writeFile(location, content) {
const self = this;
self.logger.info(`Creating the following file ${location}`);
return new Promise(function(resolve, reject) {
fs.writeFile(location, content, (err) => {
if (err) {
self.logger.error(`Error creating file in the cloud at ${location}. Error: ${err}`);
const errMsg = `Error creating file in the cloud at ${location}. Error: ${err}`;
reject(errMsg);
} else {
self.logger.info(`Successfully created ${location}`);
resolve(null);
}
});
});
}
错误:EIO:i/o 错误,打开
解决方案
推荐阅读
- python - TypeError:字符串索引必须是整数 - JSON Python
- rabbitmq - RabbitMQ 暂停队列
- c++ - 图表中的 DFS 需要多少时间间隔?
- opencv - 如何将外部 RGB 摄像头与 Azure Kinect 深度传感器对齐
- email - 配置凭据的 Hybris EmailService
- html - 有没有办法在html5的按钮中写指数?
- qt - QtConcurrent 与索引映射
- google-sheets - 基于另一张工作表的 Google 表格条件格式
- python - 'int' 对象在字典上使用哈希后不可迭代
- mysql - 在 CentOS 上的 whm 中更改 mysqld 的启动选项