How do you decompress search.json.mozlz4?

Discussion about official Mozilla Firefox builds
Locked
User avatar
streetwolf
Posts: 2700
Joined: August 21st, 2011, 8:07 am
Location: NJ (USA)

How do you decompress search.json.mozlz4?

Post by streetwolf »

I tried LZ4.exe but it didn't recognize the file, possibly because it's called moslz4 and not lz4. Is there a way on Windows 10 to decompress this file?
Intel i9-13900K | ASUS ROG MAXIMUS Z790 HERO DDR5 | 64GB CORSAIR VENGEANCE DDR5 @ 6400 Mhz.
H100i ELITE CAPELLIX XT Liquid CPU Cooler | PNY 12GB GeForce RTX 3080 Ti | 2 CORSAIR 2TB MP600 PRO XT GEN 4
HX1200 PLATINUM PSU | XENEON 32" IPS UHD 144Hz | BenQ 32" UHD | MS Windows 11 Pro
User avatar
Alice0775
Posts: 2817
Joined: October 26th, 2007, 11:25 pm
Location: OSAKA

Re: How do you decompress search.json.mozlz4?

Post by Alice0775 »

streetwolf wrote:I tried LZ4.exe but it didn't recognize the file, possibly because it's called moslz4 and not lz4. Is there a way on Windows 10 to decompress this file?
Execute the following code in Browser Console ( set devtools.chrome.enabled=true inabout:config )

search.json.mozlz4 -> search.json

Code: Select all

function decompress() {
  Task.spawn(function() {
    let cacheFilePath = OS.Path.join(OS.Constants.Path.profileDir, "search.json.mozlz4");
    let bytes = yield OS.File.read(cacheFilePath, {compression: "lz4"});
    let data = new TextDecoder().decode(bytes);
    let jsonFilePath = OS.Path.join(OS.Constants.Path.profileDir, "search.json");
    OS.File.writeAtomic(jsonFilePath, data);
  });
}
decompress();
search.json -> search.json.mozlz4_new

Code: Select all

function compress() {
  Task.spawn(function() {
    let jsonFilePath = OS.Path.join(OS.Constants.Path.profileDir, "search.json");
    let bytes = yield OS.File.read(jsonFilePath);
    let data = new TextDecoder().decode(bytes);
    let cacheFilePath = OS.Path.join(OS.Constants.Path.profileDir, "search.json.mozlz4_new");
    OS.File.writeAtomic(cacheFilePath, data, {compression: "lz4"});
  });
}
compress();
User avatar
streetwolf
Posts: 2700
Joined: August 21st, 2011, 8:07 am
Location: NJ (USA)

Re: How do you decompress search.json.mozlz4?

Post by streetwolf »

thanks Alice.
Intel i9-13900K | ASUS ROG MAXIMUS Z790 HERO DDR5 | 64GB CORSAIR VENGEANCE DDR5 @ 6400 Mhz.
H100i ELITE CAPELLIX XT Liquid CPU Cooler | PNY 12GB GeForce RTX 3080 Ti | 2 CORSAIR 2TB MP600 PRO XT GEN 4
HX1200 PLATINUM PSU | XENEON 32" IPS UHD 144Hz | BenQ 32" UHD | MS Windows 11 Pro
User avatar
Pgr
Posts: 233
Joined: October 28th, 2003, 10:00 am
Location: Lisbon, Portugal

Re: How do you decompress search.json.mozlz4?

Post by Pgr »

@Alice0775

I tried your function on my Firefox 64, in the Developer Console, and I got the following error:

Code: Select all

yield expression is only valid in generators
Do you know what this means and, more importantly, how to work around it?

Thanks a lot, I'd really like to get this working. :D
Fanolian
Posts: 940
Joined: February 21st, 2011, 10:14 am

Re: How do you decompress search.json.mozlz4?

Post by Fanolian »

morat
Posts: 6403
Joined: February 3rd, 2009, 6:29 pm

Re: How do you decompress search.json.mozlz4?

Post by morat »

Brummelchen
Posts: 4480
Joined: March 19th, 2005, 10:51 am

Re: How do you decompress search.json.mozlz4?

Post by Brummelchen »

jep, i have b'Ämarked jefferson his site :thumbsup:
the magic number is 51 and you are probably part of it :p
User avatar
therube
Posts: 21699
Joined: March 10th, 2004, 9:59 pm
Location: Maryland USA

Re: How do you decompress search.json.mozlz4?

Post by therube »

(For Windows users) dejsonlz4.v1.1 should work.

Code: Select all

Usage: dejsonlz4 [-h] IN_FILE [OUT_FILE]
   -h  Display this help and exit.
Decompress Mozilla bookmarks backup file IN_FILE to OUT_FILE.
If OUT_FILE is '-' or missing, decompress to standard output.
Fire 750, bring back 250.
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.19) Gecko/20110420 SeaMonkey/2.0.14 Pinball CopyURL+ FetchTextURL FlashGot NoScript
Locked