| 943 | * @return {String} the EOCD record. |
| 944 | */ |
| 945 | var generateCentralDirectoryEnd = function (entriesCount, centralDirLength, localDirLength, comment, encodeFileName) { |
| 946 | var dirEnd = ""; |
| 947 | var encodedComment = utils.transformTo("string", encodeFileName(comment)); |
| 948 | |
| 949 | // end of central dir signature |
| 950 | dirEnd = signature.CENTRAL_DIRECTORY_END + |
| 951 | // number of this disk |
| 952 | "\x00\x00" + |
| 953 | // number of the disk with the start of the central directory |
| 954 | "\x00\x00" + |
| 955 | // total number of entries in the central directory on this disk |
| 956 | decToHex(entriesCount, 2) + |
| 957 | // total number of entries in the central directory |
| 958 | decToHex(entriesCount, 2) + |
| 959 | // size of the central directory 4 bytes |
| 960 | decToHex(centralDirLength, 4) + |
| 961 | // offset of start of central directory with respect to the starting disk number |
| 962 | decToHex(localDirLength, 4) + |
| 963 | // .ZIP file comment length |
| 964 | decToHex(encodedComment.length, 2) + |
| 965 | // .ZIP file comment |
| 966 | encodedComment; |
| 967 | |
| 968 | return dirEnd; |
| 969 | }; |
| 970 | |
| 971 | /** |
| 972 | * Generate data descriptors for a file entry. |