docs/bower_components/bootstrap/assets/js/jszip.js
function(name, file, compressedObject, offset) {
      var data = compressedObject.compressedContent,
          utfEncodedFileName = this.utf8encode(file.name),
          useUTF8 = utfEncodedFileName !== file.name,
          o       = file.options,
          dosTime,
          dosDate;

      // date
      // @see http://www.delorie.com/djgpp/doc/rbinter/it/52/13.html
      // @see http://www.delorie.com/djgpp/doc/rbinter/it/65/16.html
      // @see http://www.delorie.com/djgpp/doc/rbinter/it/66/16.html

      dosTime = o.date.getHours();
      dosTime = dosTime << 6;
      dosTime = dosTime | o.date.getMinutes();
      dosTime = dosTime << 5;
      dosTime = dosTime | o.date.getSeconds() / 2;

      dosDate = o.date.getFullYear() - 1980;
      dosDate = dosDate << 4;
      dosDate = dosDate | (o.date.getMonth() + 1);
      dosDate = dosDate << 5;
      dosDate = dosDate | o.date.getDate();


      var header = "";

      // version needed to extract
      header += "\x0A\x00";
      // general purpose bit flag
      // set bit 11 if utf8
      header += useUTF8 ? "\x00\x08" : "\x00\x00";
      // compression method
      header += compressedObject.compressionMethod;
      // last mod file time
      header += decToHex(dosTime, 2);
      // last mod file date
      header += decToHex(dosDate, 2);
      // crc-32
      header += decToHex(compressedObject.crc32, 4);
      // compressed size
      header += decToHex(compressedObject.compressedSize, 4);
      // uncompressed size
      header += decToHex(compressedObject.uncompressedSize, 4);
      // file name length
      header += decToHex(utfEncodedFileName.length, 2);
      // extra field length
      header += "\x00\x00";


      var fileRecord = JSZip.signature.LOCAL_FILE_HEADER + header + utfEncodedFileName;

      var dirRecord = JSZip.signature.CENTRAL_FILE_HEADER +
      // version made by (00: DOS)
      "\x14\x00" +
      // file header (common to file and central directory)
      header +
      // file comment length
      "\x00\x00" +
      // disk number start
      "\x00\x00" +
      // internal file attributes TODO
      "\x00\x00" +
      // external file attributes
      (file.options.dir===true?"\x10\x00\x00\x00":"\x00\x00\x00\x00")+
      // relative offset of local header
      decToHex(offset, 4) +
      // file name
      utfEncodedFileName;


      return {
         fileRecord : fileRecord,
         dirRecord : dirRecord,
         compressedObject : compressedObject
      };
   }
function(name, file, compressedObject, offset) {
      var data = compressedObject.compressedContent,
          utfEncodedFileName = this.utf8encode(file.name),
          useUTF8 = utfEncodedFileName !== file.name,
          o       = file.options,
          dosTime,
          dosDate;

      // date
      // @see http://www.delorie.com/djgpp/doc/rbinter/it/52/13.html
      // @see http://www.delorie.com/djgpp/doc/rbinter/it/65/16.html
      // @see http://www.delorie.com/djgpp/doc/rbinter/it/66/16.html

      dosTime = o.date.getHours();
      dosTime = dosTime << 6;
      dosTime = dosTime | o.date.getMinutes();
      dosTime = dosTime << 5;
      dosTime = dosTime | o.date.getSeconds() / 2;

      dosDate = o.date.getFullYear() - 1980;
      dosDate = dosDate << 4;
      dosDate = dosDate | (o.date.getMonth() + 1);
      dosDate = dosDate << 5;
      dosDate = dosDate | o.date.getDate();


      var header = "";

      // version needed to extract
      header += "\x0A\x00";
      // general purpose bit flag
      // set bit 11 if utf8
      header += useUTF8 ? "\x00\x08" : "\x00\x00";
      // compression method
      header += compressedObject.compressionMethod;
      // last mod file time
      header += decToHex(dosTime, 2);
      // last mod file date
      header += decToHex(dosDate, 2);
      // crc-32
      header += decToHex(compressedObject.crc32, 4);
      // compressed size
      header += decToHex(compressedObject.compressedSize, 4);
      // uncompressed size
      header += decToHex(compressedObject.uncompressedSize, 4);
      // file name length
      header += decToHex(utfEncodedFileName.length, 2);
      // extra field length
      header += "\x00\x00";


      var fileRecord = JSZip.signature.LOCAL_FILE_HEADER + header + utfEncodedFileName;

      var dirRecord = JSZip.signature.CENTRAL_FILE_HEADER +
      // version made by (00: DOS)
      "\x14\x00" +
      // file header (common to file and central directory)
      header +
      // file comment length
      "\x00\x00" +
      // disk number start
      "\x00\x00" +
      // internal file attributes TODO
      "\x00\x00" +
      // external file attributes
      (file.options.dir===true?"\x10\x00\x00\x00":"\x00\x00\x00\x00")+
      // relative offset of local header
      decToHex(offset, 4) +
      // file name
      utfEncodedFileName;


      return {
         fileRecord : fileRecord,
         dirRecord : dirRecord,
         compressedObject : compressedObject
      };
   }
function ( name , file , compressedObject , offset ) { var data = compressedObject . compressedContent , utfEncodedFileName = this . utf8encode ( file . name ) , useUTF8 = utfEncodedFileName !== file . name , o = file . options , dosTime , dosDate ; // date // @see http://www.delorie.com/djgpp/doc/rbinter/it/52/13.html // @see http://www.delorie.com/djgpp/doc/rbinter/it/65/16.html // @see http://www.delorie.com/djgpp/doc/rbinter/it/66/16.html dosTime = o . date . getHours ( ) ; dosTime = dosTime << 6 ; dosTime = dosTime | o . date . getMinutes ( ) ; dosTime = dosTime << 5 ; dosTime = dosTime | o . date . getSeconds ( ) / 2 ; dosDate = o . date . getFullYear ( ) - 1980 ; dosDate = dosDate << 4 ; dosDate = dosDate | ( o . date . getMonth ( ) + 1 ) ; dosDate = dosDate << 5 ; dosDate = dosDate | o . date . getDate ( ) ; var header = "" ; // version needed to extract header += "\x0A\x00" ; // general purpose bit flag // set bit 11 if utf8 header += useUTF8 ? "\x00\x08" : "\x00\x00" ; // compression method header += compressedObject . compressionMethod ; // last mod file time header += decToHex ( dosTime , 2 ) ; // last mod file date header += decToHex ( dosDate , 2 ) ; // crc-32 header += decToHex ( compressedObject . crc32 , 4 ) ; // compressed size header += decToHex ( compressedObject . compressedSize , 4 ) ; // uncompressed size header += decToHex ( compressedObject . uncompressedSize , 4 ) ; // file name length header += decToHex ( utfEncodedFileName . length , 2 ) ; // extra field length header += "\x00\x00" ; var fileRecord = JSZip . signature . LOCAL_FILE_HEADER + header + utfEncodedFileName ; var dirRecord = JSZip . signature . CENTRAL_FILE_HEADER + // version made by (00: DOS) "\x14\x00" + // file header (common to file and central directory) header + // file comment length "\x00\x00" + // disk number start "\x00\x00" + // internal file attributes TODO "\x00\x00" + // external file attributes ( file . options . dir === true ? "\x10\x00\x00\x00" : "\x00\x00\x00\x00" ) + // relative offset of local header decToHex ( offset , 4 ) + // file name utfEncodedFileName ; return { fileRecord : fileRecord , dirRecord : dirRecord , compressedObject : compressedObject } ; }
Generate the various parts used in the construction of the final zip file.
@param {string} name the file name.
@param {ZipObject} file the file content.
@param {JSZip.CompressedObject} compressedObject the compressed object.
@param {number} offset the current offset from the start of the zip file.
@return {object} the zip parts.
Generate the various parts used in the construction of the final zip file .