2019-03-11 13:14:26 -04:00
|
|
|
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
|
2019-03-14 10:24:54 -04:00
|
|
|
|
|
|
|
/** Test whether or not the given path exists by checking with the file system */
|
2019-03-11 13:14:26 -04:00
|
|
|
export async function exists(filePath: string): Promise<boolean> {
|
|
|
|
return Deno.stat(filePath)
|
|
|
|
.then(() => true)
|
|
|
|
.catch(() => false);
|
|
|
|
}
|
|
|
|
|
2019-03-14 10:24:54 -04:00
|
|
|
/** Test whether or not the given path exists by checking with the file system */
|
2019-03-11 13:14:26 -04:00
|
|
|
export function existsSync(filePath: string): boolean {
|
|
|
|
try {
|
|
|
|
Deno.statSync(filePath);
|
|
|
|
return true;
|
|
|
|
} catch {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|