D
Deno

help

How to test if a file was created?

AAnthony2be10/23/2022
I'm making a deno library that creates some folders and files, how can i check if it generates then correctly?
BBeast10/23/2022
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;
}
DDoctor10/24/2022
Deno.mkdir will throw an error if it fails to create a directory. Including if the directory already exists.
AAnthony2be10/24/2022
do i just plop this in my test file or what?
UUUnknown User10/25/2022
Message Not Public
Sign In & Join Server To View

Looking for more? Join the community!