CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
sagemathinc

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/backend/misc/async-utils-node.ts
Views: 687
1
/*
2
* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.
3
* License: MS-RSL – see LICENSE.md for details
4
*/
5
6
import { access, readFile, unlink } from "node:fs/promises";
7
8
export async function exists(path: string): Promise<boolean> {
9
// fs.exists is deprecated
10
try {
11
await access(path);
12
return true;
13
} catch {
14
return false;
15
}
16
}
17
18
export { readFile, unlink };
19
20