Skip to content
Snippets Groups Projects
is-writeable.ts 226 B
Newer Older
  • Learn to ignore specific revisions
  • import fs from 'fs'
    
    export async function isWriteable(directory: string): Promise<boolean> {
      try {
        await fs.promises.access(directory, (fs.constants || fs).W_OK)
        return true
      } catch (err) {
        return false
      }
    }