michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: */ michael@0: michael@0: const Ci = Components.interfaces; michael@0: const Cc = Components.classes; michael@0: const NS_ERROR_IN_PROGRESS = 2152398863; michael@0: michael@0: const PR_RDONLY = 0x01 michael@0: const PR_WRONLY = 0x02 michael@0: const PR_RDWR = 0x04 michael@0: const PR_CREATE_FILE = 0x08 michael@0: const PR_APPEND = 0x10 michael@0: const PR_TRUNCATE = 0x20 michael@0: const PR_SYNC = 0x40 michael@0: const PR_EXCL = 0x80 michael@0: michael@0: const ZIP_EOCDR_HEADER_SIZE = 22; michael@0: const ZIP_FILE_HEADER_SIZE = 30; michael@0: const ZIP_CDS_HEADER_SIZE = 46; michael@0: const ZIP_METHOD_STORE = 0 michael@0: const ZIP_METHOD_DEFLATE = 8 michael@0: const ZIP_EXTENDED_TIMESTAMP_SIZE = 9; michael@0: michael@0: const PR_USEC_PER_MSEC = 1000; michael@0: const PR_USEC_PER_SEC = 1000000; michael@0: const PR_MSEC_PER_SEC = 1000; michael@0: michael@0: const DATA_DIR = "data/"; michael@0: michael@0: var ioSvc = Cc["@mozilla.org/network/io-service;1"] michael@0: .getService(Ci.nsIIOService); michael@0: michael@0: var ZipWriter = Components.Constructor("@mozilla.org/zipwriter;1", michael@0: "nsIZipWriter"); michael@0: var ZipReader = Components.Constructor("@mozilla.org/libjar/zip-reader;1", michael@0: "nsIZipReader", "open"); michael@0: michael@0: var tmpDir = do_get_profile(); michael@0: var tmpFile = tmpDir.clone(); michael@0: tmpFile.append("zipwriter-test.zip"); michael@0: if (tmpFile.exists()) michael@0: tmpFile.remove(true); michael@0: michael@0: var zipW = new ZipWriter();