cknight
cknight10mo ago

Available disk space

I'm writing an API which will potentially create a large temporary file. I thought it would useful to validate that there was enough space on the disk to write the file before proceeding, however, I can't find a way to achieve this. Is there a cross-platform way to achieve this?
1 Reply
Deno AI Helper
Deno AI Helper10mo ago
I wasn't able to find the answer to your question in the official Deno documentation regarding checking available disk space. This specific functionality might not be directly supported by Deno's standard library at the moment. However, based on your message, there are no obvious syntax errors or mistakes to correct. Since Deno has a security-first approach, direct access to the file system is controlled and you would typically need to use the --allow-read and --allow-write flags to interact with the file system. The advice provided here is not based on the Deno documentation, and I would recommend double-checking the accuracy of this advice. For a cross-platform solution, you might need to look into third-party modules or consider using Deno's subprocess API (Deno.run) to execute a system command that can check disk space, but this would not be cross-platform by default and would require platform-specific commands. Remember to handle permissions carefully and ensure that your application is secure when accessing system resources. If a native Deno solution becomes available in the future, it should be documented in the official Deno documentation or standard library.