js-cfb/bits/44_readmfat.js

15 lines
496 B
JavaScript
Raw Normal View History

2017-11-05 16:54:11 +00:00
function get_mfat_entry(entry/*:CFBEntry*/, payload/*:RawBytes*/, mini/*:?RawBytes*/)/*:CFBlob*/ {
var start = entry.start, size = entry.size;
//return (payload.slice(start*MSSZ, start*MSSZ + size)/*:any*/);
var o = [];
var idx = start;
while(mini && size > 0 && idx >= 0) {
o.push(payload.slice(idx * MSSZ, idx * MSSZ + MSSZ));
size -= MSSZ;
idx = __readInt32LE(mini, idx * 4);
}
if(o.length === 0) return (new_buf(0)/*:any*/);
return (bconcat(o).slice(0, entry.size)/*:any*/);
}