mirror of
https://git.stupid.fish/teidesu/scripts.git
synced 2025-07-28 02:32:11 +10:00
chore: update public repo
This commit is contained in:
parent
e0109980c0
commit
e7c9507247
25 changed files with 5364 additions and 0 deletions
19
utils/fs.ts
Normal file
19
utils/fs.ts
Normal file
|
@ -0,0 +1,19 @@
|
|||
import * as fsp from 'node:fs/promises'
|
||||
|
||||
export async function fileExists(path: string): Promise<boolean> {
|
||||
try {
|
||||
const stat = await fsp.stat(path)
|
||||
return stat.isFile()
|
||||
} catch {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
export async function directoryExists(path: string): Promise<boolean> {
|
||||
try {
|
||||
const stat = await fsp.stat(path)
|
||||
return stat.isDirectory()
|
||||
} catch {
|
||||
return false
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue