Files
13f7ad3204 Add protocol node: imports (#66813)
I have added to all packages that are imported from node, the `node:`
and I have reordered the imports, first the `node:` ones to make it more
readable, as well as only importing the necessary functions.

I ran a `node --prof` before and after the modifications and it seems to
be more optimal now than before.

Co-authored-by: torresgol10.itd <[email protected]>
Co-authored-by: Sam Ko <[email protected]>
2024-06-17 00:31:10 -07:00

12 lines
253 B
TypeScript

import { W_OK } from 'node:constants'
import { access } from 'node:fs/promises'
export async function isWriteable(directory: string): Promise<boolean> {
try {
await access(directory, W_OK)
return true
} catch (err) {
return false
}
}