Open lslzl3000 opened 1 year ago
I got a similar problem, can't use this library in a read-only stateless docker
we need this fix-eature please 🥺🌻
Nothing on this?
I have the same problem, it has been a real headhake. My crappy patch has been to run this periodically: async function safeFileRename(sourcePath, destPath) {
try {
// Attempt to rename the file
await fs.promises.rename(sourcePath, destPath);
console.log(File renamed successfully: ${sourcePath} -> ${destPath}
);
} catch (error) {
if (error.code === "ENOENT") {
// Handle the case where the source file does not exist
console.error("[!!] Source file does not exist:", sourcePath);
} else {
// Handle other errors
console.error("[XX] Error renaming the file:", error.message);
}
}
}
const sourcePath = "./db.tmp.json"; const destPath = "./db.json";
safeFileRename(sourcePath, destPath).catch((error) => {
// Handle any uncaught errors here
console.error("[XX] An unhandled error occurred:", error);
});