#How to test if a file was created?

1 messages · Page 1 of 1 (latest)

bold yarrow
#

I'm making a deno library that creates some folders and files, how can i check if it generates then correctly?

distant slate
#
try {
  await Deno.open("/path_to_file");
} catch (error) {
  if (error instanceof Deno.errors.NotFound) throw error;
}
dreamy eagle
#

Deno.mkdir will throw an error if it fails to create a directory. Including if the directory already exists.

bold yarrow