mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
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]>
12 lines
253 B
TypeScript
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
|
|
}
|
|
}
|