generateUnixExternalFileAttr = function (unixPermissions, isDir) {

    var result = unixPermissions;
    if (!unixPermissions) {
        // I can't use octal values in strict mode, hence the hexa.
        //  040775 => 0x41fd
        // 0100664 => 0x81b4
        result = isDir ? 0x41fd : 0x81b4;
    }
    return (result & 0xFFFF) << 16;
}
Generate the UNIX part of the external file attributes.
@param {Object} unixPermissions the unix permissions or null.
@param {Boolean} isDir true if the entry is a directory, false otherwise.
@return {Number} a 32 bit integer.

adapted from http://unix.stackexchange.com/questions/14705/the-zip-formats-external-file-attribute :

TTTTsstrwxrwxrwx0000000000ADVSHR
^^^^____________________________ file type, see zipinfo.c (UNX_*)
    ^^^_________________________ setuid, setgid, sticky
       ^^^^^^^^^________________ permissions
                ^^^^^^^^^^______ not used ?
                          ^^^^^^ DOS attribute bits : Archive, Directory, Volume label, System file, Hidden, Read only