从容器使用fs.writefile写入已装入的DFS时出错

时间:2019-08-22 13:17:44

标签: javascript node.js fs

我正在使用fs.writeFile从docker容器写入dfs。 writefile正常工作的时间为99%,但有时会返回错误。在代码中,我创建了文件,并且不再访问它。也没有其他东西可以访问该文件。

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:输入/输出错误,打开

0 个答案:

没有答案