mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
14 lines
283 B
TypeScript
14 lines
283 B
TypeScript
|
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
|
||
|
}
|
||
|
}
|