index.js
function isWritable(p) {
    if (!fs.existsSync(p)) {
        return false;
    }
    let stats = fs.statSync(p);
    let mode = stats.mode;
    let uid = process.getuid ? process.getuid() : 0;
    let gid = process.getgid ? process.getgid() : 0;
    let owner = uid === stats.uid;
    let group = gid === stats.gid;
    return !!(owner && (mode & parseInt('00200', 8)) ||
        group && (mode & parseInt('00020', 8)) ||
        (mode & parseInt('00002', 8)));
}
function isWritable(p) {
    if (!fs.existsSync(p)) {
        return false;
    }
    let stats = fs.statSync(p);
    let mode = stats.mode;
    let uid = process.getuid ? process.getuid() : 0;
    let gid = process.getgid ? process.getgid() : 0;
    let owner = uid === stats.uid;
    let group = gid === stats.gid;
    return !!(owner && (mode & parseInt('00200', 8)) ||
        group && (mode & parseInt('00020', 8)) ||
        (mode & parseInt('00002', 8)));
}
function isWritable ( p ) { if ( ! fs . existsSync ( p ) ) { return false ; } let stats = fs . statSync ( p ) ; let mode = stats . mode ; let uid = process . getuid ? process . getuid ( ) : 0 ; let gid = process . getgid ? process . getgid ( ) : 0 ; let owner = uid === stats . uid ; let group = gid === stats . gid ; return ! ! ( owner && ( mode & parseInt ( '00200' , 8 ) ) || group && ( mode & parseInt ( '00020' , 8 ) ) || ( mode & parseInt ( '00002' , 8 ) ) ) ; }
Checks if the file or folder p is writable

@param {string} p
@returns {boolean}
Checks if the file or folder p is writable