1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00
next.js/packages/next/build/is-writeable.ts

14 lines
283 B
TypeScript
Raw Normal View History

import fs from 'fs'
import {promisify} from 'util'
const access = promisify(fs.access)
export async function isWriteable (directory: string): Promise<boolean> {
try {
await access(directory, (fs.constants || fs).W_OK)
return true
} catch (err) {
return false
}
}