epub-chinese-converter
Version:
A small util to convert epub files from Simplified Chinese to Traditional Chinese
133 lines (132 loc) • 2.95 kB
JavaScript
"use strict";
module.exports = {
/* The local file header */
LOCHDR: 30,
LOCSIG: 0x04034b50,
LOCVER: 4,
LOCFLG: 6,
LOCHOW: 8,
LOCTIM: 10,
LOCCRC: 14,
LOCSIZ: 18,
LOCLEN: 22,
LOCNAM: 26,
LOCEXT: 28,
/* The Data descriptor */
EXTSIG: 0x08074b50,
EXTHDR: 16,
EXTCRC: 4,
EXTSIZ: 8,
EXTLEN: 12,
/* The central directory file header */
CENHDR: 46,
CENSIG: 0x02014b50,
CENVEM: 4,
CENVER: 6,
CENFLG: 8,
CENHOW: 10,
CENTIM: 12,
CENCRC: 16,
CENSIZ: 20,
CENLEN: 24,
CENNAM: 28,
CENEXT: 30,
CENCOM: 32,
CENDSK: 34,
CENATT: 36,
CENATX: 38,
CENOFF: 42,
/* The entries in the end of central directory */
ENDHDR: 22,
ENDSIG: 0x06054b50,
ENDSUB: 8,
ENDTOT: 10,
ENDSIZ: 12,
ENDOFF: 16,
ENDCOM: 20,
END64HDR: 20,
END64SIG: 0x07064b50,
END64START: 4,
END64OFF: 8,
END64NUMDISKS: 16,
ZIP64SIG: 0x06064b50,
ZIP64HDR: 56,
ZIP64LEAD: 12,
ZIP64SIZE: 4,
ZIP64VEM: 12,
ZIP64VER: 14,
ZIP64DSK: 16,
ZIP64DSKDIR: 20,
ZIP64SUB: 24,
ZIP64TOT: 32,
ZIP64SIZB: 40,
ZIP64OFF: 48,
ZIP64EXTRA: 56,
/* Compression methods */
STORED: 0,
SHRUNK: 1,
REDUCED1: 2,
REDUCED2: 3,
REDUCED3: 4,
REDUCED4: 5,
IMPLODED: 6,
// 7 reserved for Tokenizing compression algorithm
DEFLATED: 8,
ENHANCED_DEFLATED: 9,
PKWARE: 10,
// 11 reserved by PKWARE
BZIP2: 12,
// 13 reserved by PKWARE
LZMA: 14,
// 15-17 reserved by PKWARE
IBM_TERSE: 18,
IBM_LZ77: 19,
AES_ENCRYPT: 99,
/* General purpose bit flag */
// values can obtained with expression 2**bitnr
FLG_ENC: 1,
FLG_COMP1: 2,
FLG_COMP2: 4,
FLG_DESC: 8,
FLG_ENH: 16,
FLG_PATCH: 32,
FLG_STR: 64,
// Bits 7-10: Currently unused.
FLG_EFS: 2048,
// Bit 12: Reserved by PKWARE for enhanced compression.
// Bit 13: encrypted the Central Directory (patented).
// Bits 14-15: Reserved by PKWARE.
FLG_MSK: 4096,
/* Load type */
FILE: 2,
BUFFER: 1,
NONE: 0,
/* 4.5 Extensible data fields */
EF_ID: 0,
EF_SIZE: 2,
/* Header IDs */
ID_ZIP64: 0x0001,
ID_AVINFO: 0x0007,
ID_PFS: 0x0008,
ID_OS2: 0x0009,
ID_NTFS: 0x000a,
ID_OPENVMS: 0x000c,
ID_UNIX: 0x000d,
ID_FORK: 0x000e,
ID_PATCH: 0x000f,
ID_X509_PKCS7: 0x0014,
ID_X509_CERTID_F: 0x0015,
ID_X509_CERTID_C: 0x0016,
ID_STRONGENC: 0x0017,
ID_RECORD_MGT: 0x0018,
ID_X509_PKCS7_RL: 0x0019,
ID_IBM1: 0x0065,
ID_IBM2: 0x0066,
ID_POSZIP: 0x4690,
EF_ZIP64_OR_32: 0xffffffff,
EF_ZIP64_OR_16: 0xffff,
EF_ZIP64_SUNCOMP: 0,
EF_ZIP64_SCOMP: 8,
EF_ZIP64_RHO: 16,
EF_ZIP64_DSN: 24
};