function getdatastr(data)/*:?string*/ { if(!data) return null; if(data.content && data.type) return cc2str(data.content, true); if(data.data) return debom(data.data); if(data.asNodeBuffer && has_buf) return debom(data.asNodeBuffer().toString('binary')); if(data.asBinary) return debom(data.asBinary()); if(data._data && data._data.getContent) return debom(cc2str(Array.prototype.slice.call(data._data.getContent(),0))); return null; } function getdatabin(data) { if(!data) return null; if(data.data) return char_codes(data.data); if(data.asNodeBuffer && has_buf) return data.asNodeBuffer(); if(data._data && data._data.getContent) { var o = data._data.getContent(); if(typeof o == "string") return char_codes(o); return Array.prototype.slice.call(o); } if(data.content && data.type) return data.content; return null; } function getdata(data) { return (data && data.name.slice(-4) === ".bin") ? getdatabin(data) : getdatastr(data); } /* Part 2 Section 10.1.2 "Mapping Content Types" Names are case-insensitive */ /* OASIS does not comment on filename case sensitivity */ function safegetzipfile(zip, file/*:string*/) { var k = zip.FullPaths || keys(zip.files); var f = file.toLowerCase().replace(/[\/]/g, '\\'), g = f.replace(/\\/g,'\/'); for(var i=0; i