Read-only FS detection
Hi, I have few deps that by default create cache/log dirs... I can disable it, but the detection itself is unclear.
Is there a better way than
Is there a better way than
false if the error is thrown, indicating that the file system is read-only. If any other error is thrown, it will be rethrown, allowing you to handle it elsewhere in your code.Deno.errors.PermissionDenied--allow-write--allow-writeDeno.errors.AlreadyExistsPermissionDenied--unstableDeno.mkdirSyncconst canWriteToFs = (() => {
try {
Deno.mkdirSync("./log", { recursive: true });
return true;
} catch (err) {
if (err instanceof Deno.errors.PermissionDenied) {
return false;
}
throw err; // Rethrow other errors
}
})();