zip.open(zipFile, openFlags); zip.addEntryFile( fileName, Ci.nsIZipWriter.COMPRESSION_DEFAULT, file, false ); zip.close(); // Remove the original file (now zipped). file.remove(true); return true; } catch (err) { console.error(err); // Something went wrong (disk space?) rename the original file back. file.moveTo(null, originalFileName); } return false; }, getLocalDirectory(path) { let dir; if (!path) { dir = Services.dirsvc.get("ProfD", Ci.nsIFile); dir.append("har"); dir.append("logs"); } else { dir = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsIFile); dir.initWithPath(path); } return dir; }, }; // Exports from this module exports.HarUtils = HarUtils; PK