js-cfb/bits/68_mini.js

21 lines
634 B
JavaScript

for(i = 1; i < cfb.FileIndex.length; ++i) {
file = cfb.FileIndex[i];
/*:: if(!file.content) throw new Error("unreachable"); */
if(file.size > 0 && file.size < 0x1000) {
if (has_buf && Buffer.isBuffer(file.content)) {
file.content.copy(o, o.l, 0, file.size);
// o is a 0-filled Buffer so just set next offset
o.l += (file.size + 63) & -64;
} else {
for(j = 0; j < file.size; ++j) o.write_shift(1, file.content[j]);
for(; j & 0x3F; ++j) o.write_shift(1, 0);
}
}
}
if (has_buf) {
o.l = o.length;
} else {
// When using Buffer, already 0-filled
while(o.l < o.length) o.write_shift(1, 0);
}