(extraField, directory, isInfoZip)
| 4133 | } |
| 4134 | |
| 4135 | function readExtraFieldUnix(extraField, directory, isInfoZip) { |
| 4136 | try { |
| 4137 | const view = getDataView$1(new Uint8Array(extraField.data)); |
| 4138 | let offset = 0; |
| 4139 | const version = getUint8(view, offset++); |
| 4140 | const uidSize = getUint8(view, offset++); |
| 4141 | const uidBytes = extraField.data.subarray(offset, offset + uidSize); |
| 4142 | offset += uidSize; |
| 4143 | const uid = unpackUnixId(uidBytes); |
| 4144 | const gidSize = getUint8(view, offset++); |
| 4145 | const gidBytes = extraField.data.subarray(offset, offset + gidSize); |
| 4146 | offset += gidSize; |
| 4147 | const gid = unpackUnixId(gidBytes); |
| 4148 | let unixMode = UNDEFINED_VALUE; |
| 4149 | if (!isInfoZip && offset + 2 <= extraField.data.length) { |
| 4150 | const base = extraField.data; |
| 4151 | const modeView = new DataView(base.buffer, base.byteOffset + offset, 2); |
| 4152 | unixMode = modeView.getUint16(0, true); |
| 4153 | } |
| 4154 | Object.assign(extraField, { version, uid, gid, unixMode }); |
| 4155 | if (uid !== UNDEFINED_VALUE) { |
| 4156 | directory.uid = uid; |
| 4157 | } |
| 4158 | if (gid !== UNDEFINED_VALUE) { |
| 4159 | directory.gid = gid; |
| 4160 | } |
| 4161 | if (unixMode !== UNDEFINED_VALUE) { |
| 4162 | directory.unixMode = unixMode; |
| 4163 | } |
| 4164 | } catch { |
| 4165 | // ignored |
| 4166 | } |
| 4167 | } |
| 4168 | |
| 4169 | function unpackUnixId(bytes) { |
| 4170 | const buffer = new Uint8Array(4); |
no test coverage detected
searching dependent graphs…