2018-12-03 14:18:52 +01:00
|
|
|
import fs from 'fs'
|
|
|
|
|
2019-05-29 13:57:26 +02:00
|
|
|
export async function isWriteable(directory: string): Promise<boolean> {
|
2018-12-03 14:18:52 +01:00
|
|
|
try {
|
2020-05-02 06:10:19 +02:00
|
|
|
await fs.promises.access(directory, (fs.constants || fs).W_OK)
|
2018-12-03 14:18:52 +01:00
|
|
|
return true
|
|
|
|
} catch (err) {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
}
|