X
Tap here to go to the mobile version of the site.

Support Forum

Can't decompress recovered jsonlz4 session file

Posted

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

Additional System Details

Application

  • User Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36

More Information

philipp
  • Top 25 Contributor
  • Moderator
5324 solutions 23508 answers

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

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

Question owner

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

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
cor-el
  • Top 10 Contributor
  • Moderator
17578 solutions 159013 answers

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>");}
});
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. *set <b>devtools.chrome.enabled</b> to true on the <b>about:config</b> page to enable the command line *https://developer.mozilla.org/en/Tools/Browser_Console ----- <pre><nowiki>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>");} });</nowiki></pre>