Anthony2be
Anthony2be•3y ago

How to test if a file was created?

I'm making a deno library that creates some folders and files, how can i check if it generates then correctly?
4 Replies
Beast
Beast•3y ago
try {
await Deno.open("/path_to_file");
} catch (error) {
if (error instanceof Deno.errors.NotFound) throw error;
}
try {
await Deno.open("/path_to_file");
} catch (error) {
if (error instanceof Deno.errors.NotFound) throw error;
}
Doctor 🤖
Doctor 🤖•3y ago
Deno.mkdir will throw an error if it fails to create a directory. Including if the directory already exists.
Anthony2be
Anthony2beOP•3y ago
do i just plop this in my test file or what?
Unknown User
Unknown User•3y ago
Message Not Public
Sign In & Join Server To View