Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Can't decompress recovered jsonlz4 session file

  • 3 replies
  • 1 has this problem
  • 8 views
  • Paskiausią atsakymą parašė cor-el

more options

I recovered a deleted 'previous.jsonlz4' file from my SSD but FF (56.0.2) seems to ignore it completely and also tools like the "Session History Scrounger" or command line decompression tools like dejsonlz4.v1.1 or lz4_v1_8_1_win64 cannot decompress it. The file however seems to have the right size and that it has been recovered successfully. It is pretty big BTW with like 2,5 MB.

Is there a way to analyze the recovered file and to tell why it cannot be compressed?

I am using FF 56.0.2 with the TabGroup Add-on

I recovered a deleted 'previous.jsonlz4' file from my SSD but FF (56.0.2) seems to ignore it completely and also tools like the "Session History Scrounger" or command line decompression tools like dejsonlz4.v1.1 or lz4_v1_8_1_win64 cannot decompress it. The file however seems to have the right size and that it has been recovered successfully. It is pretty big BTW with like 2,5 MB. Is there a way to analyze the recovered file and to tell why it cannot be compressed? I am using FF 56.0.2 with the TabGroup Add-on

All Replies (3)

more options

hi, you could try https://www.jeffersonscher.com/res/bookbackreader.html - despite its title it should also work for sessionrestore files.

more options

Thanks Philipp! There I get the following error: "failed JSON parsing: SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data" and the text area stays blank. Kind regards

more options

If you recover (undelete) a file then it isn't guaranteed that the file isn't corrupted. Especially with bigger files and possibly fragmentation chances get lower and some clusters may have been reused.


You can use this code in the Browser Console to decompress a LZ4 file.


var {classes:Cc,interfaces:Ci,utils:Cu} = Components;
function decompressFile(oFilePath,nFilePath){
  Cu.import("resource://gre/modules/Task.jsm");
  Cu.import("resource://gre/modules/osfile.jsm");
  return Task.spawn(function* () {
    var jsonString = yield OS.File.read(oFilePath,{compression:"lz4"});
    yield OS.File.writeAtomic(nFilePath, jsonString);})
}
// Set up file chooser
var fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
var fu = Cu.import("resource://gre/modules/FileUtils.jsm").FileUtils
fp.init(window, "Open File", Ci.nsIFilePicker.modeOpen);
fp.appendFilter("Bookmarks/Session (.jsonlz4)","*.jsonlz4");
fp.appendFilter("Search Engines (.mozlz4)","*.mozlz4");
fp.appendFilter("Add-ons Files (.lz4)","*.lz4");
fp.displayDirectory = fu.File(OS.Path.join(OS.Constants.Path.profileDir, "sessionstore-backups"));
// Call file chooser
fp.open((aResult) => {
  if (aResult == Ci.nsIFilePicker.returnOK) {
  if (fp.file.exists() && fp.file.isFile() && fp.file.isReadable()) {
    var oldfile = fp.file.path;
    var newfile = oldfile + ".json";
    try {
      decompressFile(oldfile, newfile);
      console.log("Saved as: \"" + newfile + "\"");
      if(confirm("Open JSON file in a Firefox tab?")){
        var uri="file:///"+newfile.replace(/\\/g, "/");
        window.open(uri, "_blank");
      }
    }
    catch (err) {console.log(err);}
  } else {console.log("<error>");}
  } else {console.log("<canceled>");}
});