Good day.
In backup.js there are 2 function in which you use keyword 'await' probably incorrectly. These are copyFiles and saveManifest.
You don't use another related keyword 'await' so it is first hint.
I think it would be better to omit async in these two functions and return simple promises. In this case you will get:
const copyFiles = (dst, needToCopy) => {
const promises = Object.keys(needToCopy).map((hash) => {
const srcPath = needToCopy[hash];
const dstPath = `${dst}/${hash}.bck`;
return fs.copyFile(srcPath, dstPath); // you probably miss await in this line
});
return Promise.all(promises);
};
const saveManifest = (dst, timestamp, pathHash) => {
pathHash = pathHash.sort();
const content = pathHash
.map(([path, hash]) => {
return `${path}/${hash}`;
})
.join("\n");
const manifest = `${dst}/${timestamp}.csv`;
return fs.writeFile(manifest, content, { encoding: "utf-8" }); // and probably miss await in this line
};
Thank you for you job and sorry for my poor english
Good day. In backup.js there are 2 function in which you use keyword 'await' probably incorrectly. These are copyFiles and saveManifest. You don't use another related keyword 'await' so it is first hint. I think it would be better to omit async in these two functions and return simple promises. In this case you will get:
Thank you for you job and sorry for my poor english