How to decompress jsonlz4 files (Firefox bookmark backups) using the command line?Launch a GUI browser on...
List, map function based on a condition
Why does this Jet Provost strikemaster have a textured leading edge?
Why do my bicycle brakes get worse and feel more 'squishy" over time?
Simulation optimisation: Monte carlo simulation, regression, optimise within regression model?
What is the most difficult concept to grasp in Calculus 1?
The oceans and the moon
Does an Irish VISA WARNING count as "refused entry at the border of any country other than the UK?"
How can I find an old paper when the usual methods fail?
What modifiers are added to the attack and damage rolls of this unique longbow from Waterdeep: Dragon Heist?
Illustrator - SVG make thinner path
Lípínguapua dopo Pêpê
Did Pope Urban II issue the papal bull "terra nullius" in 1095?
Installing Windows to flash UEFI/ BIOS, then reinstalling Ubuntu
Graphs for which a calculus student can reasonably compute the arclength
Is there a fallacy about "appeal to 'big words'"?
Are there any cons in using rounded corners for bar graphs?
Weird resistor with dots around it
What are the advantages of this gold finger shape?
Locked room poison mystery!
What unique challenges/limitations will I face if I start a career as a pilot at 45 years old?
What is the farthest a camera can see?
Is there any official ruling on how characters go from 0th to 1st level in a class?
Help, I cannot decide when to start the story
Doesn't the speed of light limit imply the same electron can be annihilated twice?
How to decompress jsonlz4 files (Firefox bookmark backups) using the command line?
Launch a GUI browser on server without a GUI?How to tell Firefox to skip connections going to a specific address?How can I change the first line of a big gzip file without decompressing all of it?How to compress all files in folder and erase the untared versions via command line?How can I decompress and print the last few lines of a compressed text file?Using firefox is ridiculously slow with users having home directory in NFS. Why?Is there any way to verify the integrity of a xz archive without decompressing the entire archive?How to bootstrap Firefox Sync on many machines?Decompress firefox 57+ opened tabs file on Linux from the command line : Error 44 : Unrecognized header : file cannot be decodedHow to unpack a tag.gz file without having 2x free space?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
There seems to be various JavaScript+browser specific ways of decompressing this, but isn't there some way to transform jsonlz4 files to something unlz4
will read?
firefox compression lz4
add a comment |
There seems to be various JavaScript+browser specific ways of decompressing this, but isn't there some way to transform jsonlz4 files to something unlz4
will read?
firefox compression lz4
1
Cross reference: Reading "jsonlz4" bookmarkbackup files • mozillaZine Forums (2014-11-04)
– Graham Perrin
Oct 19 '17 at 1:28
add a comment |
There seems to be various JavaScript+browser specific ways of decompressing this, but isn't there some way to transform jsonlz4 files to something unlz4
will read?
firefox compression lz4
There seems to be various JavaScript+browser specific ways of decompressing this, but isn't there some way to transform jsonlz4 files to something unlz4
will read?
firefox compression lz4
firefox compression lz4
asked Nov 29 '16 at 20:15
l0b0l0b0
30.3k23 gold badges129 silver badges264 bronze badges
30.3k23 gold badges129 silver badges264 bronze badges
1
Cross reference: Reading "jsonlz4" bookmarkbackup files • mozillaZine Forums (2014-11-04)
– Graham Perrin
Oct 19 '17 at 1:28
add a comment |
1
Cross reference: Reading "jsonlz4" bookmarkbackup files • mozillaZine Forums (2014-11-04)
– Graham Perrin
Oct 19 '17 at 1:28
1
1
Cross reference: Reading "jsonlz4" bookmarkbackup files • mozillaZine Forums (2014-11-04)
– Graham Perrin
Oct 19 '17 at 1:28
Cross reference: Reading "jsonlz4" bookmarkbackup files • mozillaZine Forums (2014-11-04)
– Graham Perrin
Oct 19 '17 at 1:28
add a comment |
4 Answers
4
active
oldest
votes
I was able to unpack the jsonlz4 by using lz4json
:
apt-get install liblz4-dev
git clone https://github.com/andikleen/lz4json.git
cd lz4json
make
./lz4jsoncat ~/.mozilla/firefox/*/bookmarkbackups/*.jsonlz4
1
The andikleen solution is also good for.json.mozlz4
files e.g. as shown at github.com/andikleen/lz4json/issues/1#issuecomment-336729026 (note to self: remember, remember,gmake
on FreeBSD …).
– Graham Perrin
Oct 15 '17 at 18:02
3
Also: bugzilla.mozilla.org/show_bug.cgi?id=1209390#c4 (2016-05-13) under Mozilla bug 1209390 - Use standard lz4 file format instead of the non-standard jsonlz4/mozlz4 draws attention to avih/dejsonlz4: Decompress Mozilla Firefox bookmarks backup files
– Graham Perrin
Oct 19 '17 at 1:40
1
FWIW, andikleen's tool failed to compile, with the error "undefined reference to LZ4_decompress_safe_partial" (I did installliblz4-dev
prior to building it). avih's tool, OTOH, worked perfectly for me.
– waldyrious
Nov 6 '17 at 17:48
1
Isn't it ironic that an open-web org is using a proprietary compression format for user's data, making it non-trivial to examine your own data?!
– cnst
May 8 '18 at 4:42
@Graham-Perrin : dejsonlz4 worked very well for me. It doesn't "transform jsonlz4 files to something unlz4 will read" as requested but directly decompresses them. It would be good to make it a real answer to make it more visible.
– mivk
Jun 18 '18 at 18:26
|
show 1 more comment
Save this script in a file, e.g., mozlz4
:
#!/usr/bin/env python
from sys import *
import os
try:
import lz4.block as lz4
except ImportError:
import lz4
stdin = os.fdopen(stdin.fileno(), 'rb')
stdout = os.fdopen(stdout.fileno(), 'wb')
if argv[1:] == ['-c']:
stdout.write(b'mozLz40' + lz4.compress(stdin.read()))
elif argv[1:] == ['-d']:
assert stdin.read(8) == b'mozLz40'
stdout.write(lz4.decompress(stdin.read()))
else:
stderr.write('Usage: %s -c|-d < infile > outfilen' % argv[0])
stderr.write('Compress or decompress Mozilla-flavor LZ4 files.nn')
stderr.write('Examples:n')
stderr.write('t%s -d < infile.json.mozlz4 > outfile.jsonn' % argv[0])
stderr.write('t%s -c < infile.json > outfile.json.mozlz4n' % argv[0])
exit(1)
I had to changeimport lz4
toimport lz4.block as lz4
, but it still didn't work. Some bytes vs string related error. OTOH this script worked with the import change: gist.github.com/Tblue/62ff47bef7f894e92ed5
– user31389
Apr 19 '18 at 11:45
1
@user31389: I updated the script. Does it work now?
– Håkon A. Hjortland
Apr 20 '18 at 21:44
Wasn't working for me until I did$ pip install lz4
.
– Daniel
Jun 14 at 23:51
add a comment |
Actually almost all Firefox profile lz4 files are mozlz4 files. It means they have the same "file format header".
Except one file. I talk about webext.sc.lz4 file. It has mozJSSCLz40v001
file header and maybe some sc
packaging to pack group of files to on byte stream.
There is a Firefox addon to read or compress .mozlz4 text files mozlz4-edit
add a comment |
Sufficiently persistent Googling for this turns up a lot of solutions, but most of them seem to be either (a) broken by subsequent changes to underlying libraries, or (b) unnecessarily complex (at least to my personal taste), making them clunky to drop into existing code.
The following appears to work at least on Python 2.7 and 3.6 using a recent version of the Python LZ4 bindings:
def mozlz4_to_text(filepath):
# Given the path to a "mozlz4", "jsonlz4", "baklz4" etc. file,
# return the uncompressed text.
import lz4.block
bytestream = open(filepath, "rb")
bytestream.read(8) # skip past the b"mozLz40" header
valid_bytes = bytestream.read()
text = lz4.block.decompress(valid_bytes)
return text
Of course this does not attempt to validate inputs (or outputs), is not intended to be secure, etc., but if one just wants to be able to parse one's own FF data, it gets the basic job done.
Command line version here, which could be saved in the relevant directory and invoked from the command line as:
chmod +x mozlz4.py
./mozlz4.py <file you want to read> <file to save output to>
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f326897%2fhow-to-decompress-jsonlz4-files-firefox-bookmark-backups-using-the-command-lin%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
I was able to unpack the jsonlz4 by using lz4json
:
apt-get install liblz4-dev
git clone https://github.com/andikleen/lz4json.git
cd lz4json
make
./lz4jsoncat ~/.mozilla/firefox/*/bookmarkbackups/*.jsonlz4
1
The andikleen solution is also good for.json.mozlz4
files e.g. as shown at github.com/andikleen/lz4json/issues/1#issuecomment-336729026 (note to self: remember, remember,gmake
on FreeBSD …).
– Graham Perrin
Oct 15 '17 at 18:02
3
Also: bugzilla.mozilla.org/show_bug.cgi?id=1209390#c4 (2016-05-13) under Mozilla bug 1209390 - Use standard lz4 file format instead of the non-standard jsonlz4/mozlz4 draws attention to avih/dejsonlz4: Decompress Mozilla Firefox bookmarks backup files
– Graham Perrin
Oct 19 '17 at 1:40
1
FWIW, andikleen's tool failed to compile, with the error "undefined reference to LZ4_decompress_safe_partial" (I did installliblz4-dev
prior to building it). avih's tool, OTOH, worked perfectly for me.
– waldyrious
Nov 6 '17 at 17:48
1
Isn't it ironic that an open-web org is using a proprietary compression format for user's data, making it non-trivial to examine your own data?!
– cnst
May 8 '18 at 4:42
@Graham-Perrin : dejsonlz4 worked very well for me. It doesn't "transform jsonlz4 files to something unlz4 will read" as requested but directly decompresses them. It would be good to make it a real answer to make it more visible.
– mivk
Jun 18 '18 at 18:26
|
show 1 more comment
I was able to unpack the jsonlz4 by using lz4json
:
apt-get install liblz4-dev
git clone https://github.com/andikleen/lz4json.git
cd lz4json
make
./lz4jsoncat ~/.mozilla/firefox/*/bookmarkbackups/*.jsonlz4
1
The andikleen solution is also good for.json.mozlz4
files e.g. as shown at github.com/andikleen/lz4json/issues/1#issuecomment-336729026 (note to self: remember, remember,gmake
on FreeBSD …).
– Graham Perrin
Oct 15 '17 at 18:02
3
Also: bugzilla.mozilla.org/show_bug.cgi?id=1209390#c4 (2016-05-13) under Mozilla bug 1209390 - Use standard lz4 file format instead of the non-standard jsonlz4/mozlz4 draws attention to avih/dejsonlz4: Decompress Mozilla Firefox bookmarks backup files
– Graham Perrin
Oct 19 '17 at 1:40
1
FWIW, andikleen's tool failed to compile, with the error "undefined reference to LZ4_decompress_safe_partial" (I did installliblz4-dev
prior to building it). avih's tool, OTOH, worked perfectly for me.
– waldyrious
Nov 6 '17 at 17:48
1
Isn't it ironic that an open-web org is using a proprietary compression format for user's data, making it non-trivial to examine your own data?!
– cnst
May 8 '18 at 4:42
@Graham-Perrin : dejsonlz4 worked very well for me. It doesn't "transform jsonlz4 files to something unlz4 will read" as requested but directly decompresses them. It would be good to make it a real answer to make it more visible.
– mivk
Jun 18 '18 at 18:26
|
show 1 more comment
I was able to unpack the jsonlz4 by using lz4json
:
apt-get install liblz4-dev
git clone https://github.com/andikleen/lz4json.git
cd lz4json
make
./lz4jsoncat ~/.mozilla/firefox/*/bookmarkbackups/*.jsonlz4
I was able to unpack the jsonlz4 by using lz4json
:
apt-get install liblz4-dev
git clone https://github.com/andikleen/lz4json.git
cd lz4json
make
./lz4jsoncat ~/.mozilla/firefox/*/bookmarkbackups/*.jsonlz4
edited Jan 20 '17 at 22:28
l0b0
30.3k23 gold badges129 silver badges264 bronze badges
30.3k23 gold badges129 silver badges264 bronze badges
answered Jan 20 '17 at 13:19
RolfRolf
1861 silver badge3 bronze badges
1861 silver badge3 bronze badges
1
The andikleen solution is also good for.json.mozlz4
files e.g. as shown at github.com/andikleen/lz4json/issues/1#issuecomment-336729026 (note to self: remember, remember,gmake
on FreeBSD …).
– Graham Perrin
Oct 15 '17 at 18:02
3
Also: bugzilla.mozilla.org/show_bug.cgi?id=1209390#c4 (2016-05-13) under Mozilla bug 1209390 - Use standard lz4 file format instead of the non-standard jsonlz4/mozlz4 draws attention to avih/dejsonlz4: Decompress Mozilla Firefox bookmarks backup files
– Graham Perrin
Oct 19 '17 at 1:40
1
FWIW, andikleen's tool failed to compile, with the error "undefined reference to LZ4_decompress_safe_partial" (I did installliblz4-dev
prior to building it). avih's tool, OTOH, worked perfectly for me.
– waldyrious
Nov 6 '17 at 17:48
1
Isn't it ironic that an open-web org is using a proprietary compression format for user's data, making it non-trivial to examine your own data?!
– cnst
May 8 '18 at 4:42
@Graham-Perrin : dejsonlz4 worked very well for me. It doesn't "transform jsonlz4 files to something unlz4 will read" as requested but directly decompresses them. It would be good to make it a real answer to make it more visible.
– mivk
Jun 18 '18 at 18:26
|
show 1 more comment
1
The andikleen solution is also good for.json.mozlz4
files e.g. as shown at github.com/andikleen/lz4json/issues/1#issuecomment-336729026 (note to self: remember, remember,gmake
on FreeBSD …).
– Graham Perrin
Oct 15 '17 at 18:02
3
Also: bugzilla.mozilla.org/show_bug.cgi?id=1209390#c4 (2016-05-13) under Mozilla bug 1209390 - Use standard lz4 file format instead of the non-standard jsonlz4/mozlz4 draws attention to avih/dejsonlz4: Decompress Mozilla Firefox bookmarks backup files
– Graham Perrin
Oct 19 '17 at 1:40
1
FWIW, andikleen's tool failed to compile, with the error "undefined reference to LZ4_decompress_safe_partial" (I did installliblz4-dev
prior to building it). avih's tool, OTOH, worked perfectly for me.
– waldyrious
Nov 6 '17 at 17:48
1
Isn't it ironic that an open-web org is using a proprietary compression format for user's data, making it non-trivial to examine your own data?!
– cnst
May 8 '18 at 4:42
@Graham-Perrin : dejsonlz4 worked very well for me. It doesn't "transform jsonlz4 files to something unlz4 will read" as requested but directly decompresses them. It would be good to make it a real answer to make it more visible.
– mivk
Jun 18 '18 at 18:26
1
1
The andikleen solution is also good for
.json.mozlz4
files e.g. as shown at github.com/andikleen/lz4json/issues/1#issuecomment-336729026 (note to self: remember, remember, gmake
on FreeBSD …).– Graham Perrin
Oct 15 '17 at 18:02
The andikleen solution is also good for
.json.mozlz4
files e.g. as shown at github.com/andikleen/lz4json/issues/1#issuecomment-336729026 (note to self: remember, remember, gmake
on FreeBSD …).– Graham Perrin
Oct 15 '17 at 18:02
3
3
Also: bugzilla.mozilla.org/show_bug.cgi?id=1209390#c4 (2016-05-13) under Mozilla bug 1209390 - Use standard lz4 file format instead of the non-standard jsonlz4/mozlz4 draws attention to avih/dejsonlz4: Decompress Mozilla Firefox bookmarks backup files
– Graham Perrin
Oct 19 '17 at 1:40
Also: bugzilla.mozilla.org/show_bug.cgi?id=1209390#c4 (2016-05-13) under Mozilla bug 1209390 - Use standard lz4 file format instead of the non-standard jsonlz4/mozlz4 draws attention to avih/dejsonlz4: Decompress Mozilla Firefox bookmarks backup files
– Graham Perrin
Oct 19 '17 at 1:40
1
1
FWIW, andikleen's tool failed to compile, with the error "undefined reference to LZ4_decompress_safe_partial" (I did install
liblz4-dev
prior to building it). avih's tool, OTOH, worked perfectly for me.– waldyrious
Nov 6 '17 at 17:48
FWIW, andikleen's tool failed to compile, with the error "undefined reference to LZ4_decompress_safe_partial" (I did install
liblz4-dev
prior to building it). avih's tool, OTOH, worked perfectly for me.– waldyrious
Nov 6 '17 at 17:48
1
1
Isn't it ironic that an open-web org is using a proprietary compression format for user's data, making it non-trivial to examine your own data?!
– cnst
May 8 '18 at 4:42
Isn't it ironic that an open-web org is using a proprietary compression format for user's data, making it non-trivial to examine your own data?!
– cnst
May 8 '18 at 4:42
@Graham-Perrin : dejsonlz4 worked very well for me. It doesn't "transform jsonlz4 files to something unlz4 will read" as requested but directly decompresses them. It would be good to make it a real answer to make it more visible.
– mivk
Jun 18 '18 at 18:26
@Graham-Perrin : dejsonlz4 worked very well for me. It doesn't "transform jsonlz4 files to something unlz4 will read" as requested but directly decompresses them. It would be good to make it a real answer to make it more visible.
– mivk
Jun 18 '18 at 18:26
|
show 1 more comment
Save this script in a file, e.g., mozlz4
:
#!/usr/bin/env python
from sys import *
import os
try:
import lz4.block as lz4
except ImportError:
import lz4
stdin = os.fdopen(stdin.fileno(), 'rb')
stdout = os.fdopen(stdout.fileno(), 'wb')
if argv[1:] == ['-c']:
stdout.write(b'mozLz40' + lz4.compress(stdin.read()))
elif argv[1:] == ['-d']:
assert stdin.read(8) == b'mozLz40'
stdout.write(lz4.decompress(stdin.read()))
else:
stderr.write('Usage: %s -c|-d < infile > outfilen' % argv[0])
stderr.write('Compress or decompress Mozilla-flavor LZ4 files.nn')
stderr.write('Examples:n')
stderr.write('t%s -d < infile.json.mozlz4 > outfile.jsonn' % argv[0])
stderr.write('t%s -c < infile.json > outfile.json.mozlz4n' % argv[0])
exit(1)
I had to changeimport lz4
toimport lz4.block as lz4
, but it still didn't work. Some bytes vs string related error. OTOH this script worked with the import change: gist.github.com/Tblue/62ff47bef7f894e92ed5
– user31389
Apr 19 '18 at 11:45
1
@user31389: I updated the script. Does it work now?
– Håkon A. Hjortland
Apr 20 '18 at 21:44
Wasn't working for me until I did$ pip install lz4
.
– Daniel
Jun 14 at 23:51
add a comment |
Save this script in a file, e.g., mozlz4
:
#!/usr/bin/env python
from sys import *
import os
try:
import lz4.block as lz4
except ImportError:
import lz4
stdin = os.fdopen(stdin.fileno(), 'rb')
stdout = os.fdopen(stdout.fileno(), 'wb')
if argv[1:] == ['-c']:
stdout.write(b'mozLz40' + lz4.compress(stdin.read()))
elif argv[1:] == ['-d']:
assert stdin.read(8) == b'mozLz40'
stdout.write(lz4.decompress(stdin.read()))
else:
stderr.write('Usage: %s -c|-d < infile > outfilen' % argv[0])
stderr.write('Compress or decompress Mozilla-flavor LZ4 files.nn')
stderr.write('Examples:n')
stderr.write('t%s -d < infile.json.mozlz4 > outfile.jsonn' % argv[0])
stderr.write('t%s -c < infile.json > outfile.json.mozlz4n' % argv[0])
exit(1)
I had to changeimport lz4
toimport lz4.block as lz4
, but it still didn't work. Some bytes vs string related error. OTOH this script worked with the import change: gist.github.com/Tblue/62ff47bef7f894e92ed5
– user31389
Apr 19 '18 at 11:45
1
@user31389: I updated the script. Does it work now?
– Håkon A. Hjortland
Apr 20 '18 at 21:44
Wasn't working for me until I did$ pip install lz4
.
– Daniel
Jun 14 at 23:51
add a comment |
Save this script in a file, e.g., mozlz4
:
#!/usr/bin/env python
from sys import *
import os
try:
import lz4.block as lz4
except ImportError:
import lz4
stdin = os.fdopen(stdin.fileno(), 'rb')
stdout = os.fdopen(stdout.fileno(), 'wb')
if argv[1:] == ['-c']:
stdout.write(b'mozLz40' + lz4.compress(stdin.read()))
elif argv[1:] == ['-d']:
assert stdin.read(8) == b'mozLz40'
stdout.write(lz4.decompress(stdin.read()))
else:
stderr.write('Usage: %s -c|-d < infile > outfilen' % argv[0])
stderr.write('Compress or decompress Mozilla-flavor LZ4 files.nn')
stderr.write('Examples:n')
stderr.write('t%s -d < infile.json.mozlz4 > outfile.jsonn' % argv[0])
stderr.write('t%s -c < infile.json > outfile.json.mozlz4n' % argv[0])
exit(1)
Save this script in a file, e.g., mozlz4
:
#!/usr/bin/env python
from sys import *
import os
try:
import lz4.block as lz4
except ImportError:
import lz4
stdin = os.fdopen(stdin.fileno(), 'rb')
stdout = os.fdopen(stdout.fileno(), 'wb')
if argv[1:] == ['-c']:
stdout.write(b'mozLz40' + lz4.compress(stdin.read()))
elif argv[1:] == ['-d']:
assert stdin.read(8) == b'mozLz40'
stdout.write(lz4.decompress(stdin.read()))
else:
stderr.write('Usage: %s -c|-d < infile > outfilen' % argv[0])
stderr.write('Compress or decompress Mozilla-flavor LZ4 files.nn')
stderr.write('Examples:n')
stderr.write('t%s -d < infile.json.mozlz4 > outfile.jsonn' % argv[0])
stderr.write('t%s -c < infile.json > outfile.json.mozlz4n' % argv[0])
exit(1)
edited yesterday
xiota
1429 bronze badges
1429 bronze badges
answered Apr 1 '18 at 19:11
Håkon A. HjortlandHåkon A. Hjortland
2412 silver badges4 bronze badges
2412 silver badges4 bronze badges
I had to changeimport lz4
toimport lz4.block as lz4
, but it still didn't work. Some bytes vs string related error. OTOH this script worked with the import change: gist.github.com/Tblue/62ff47bef7f894e92ed5
– user31389
Apr 19 '18 at 11:45
1
@user31389: I updated the script. Does it work now?
– Håkon A. Hjortland
Apr 20 '18 at 21:44
Wasn't working for me until I did$ pip install lz4
.
– Daniel
Jun 14 at 23:51
add a comment |
I had to changeimport lz4
toimport lz4.block as lz4
, but it still didn't work. Some bytes vs string related error. OTOH this script worked with the import change: gist.github.com/Tblue/62ff47bef7f894e92ed5
– user31389
Apr 19 '18 at 11:45
1
@user31389: I updated the script. Does it work now?
– Håkon A. Hjortland
Apr 20 '18 at 21:44
Wasn't working for me until I did$ pip install lz4
.
– Daniel
Jun 14 at 23:51
I had to change
import lz4
to import lz4.block as lz4
, but it still didn't work. Some bytes vs string related error. OTOH this script worked with the import change: gist.github.com/Tblue/62ff47bef7f894e92ed5– user31389
Apr 19 '18 at 11:45
I had to change
import lz4
to import lz4.block as lz4
, but it still didn't work. Some bytes vs string related error. OTOH this script worked with the import change: gist.github.com/Tblue/62ff47bef7f894e92ed5– user31389
Apr 19 '18 at 11:45
1
1
@user31389: I updated the script. Does it work now?
– Håkon A. Hjortland
Apr 20 '18 at 21:44
@user31389: I updated the script. Does it work now?
– Håkon A. Hjortland
Apr 20 '18 at 21:44
Wasn't working for me until I did
$ pip install lz4
.– Daniel
Jun 14 at 23:51
Wasn't working for me until I did
$ pip install lz4
.– Daniel
Jun 14 at 23:51
add a comment |
Actually almost all Firefox profile lz4 files are mozlz4 files. It means they have the same "file format header".
Except one file. I talk about webext.sc.lz4 file. It has mozJSSCLz40v001
file header and maybe some sc
packaging to pack group of files to on byte stream.
There is a Firefox addon to read or compress .mozlz4 text files mozlz4-edit
add a comment |
Actually almost all Firefox profile lz4 files are mozlz4 files. It means they have the same "file format header".
Except one file. I talk about webext.sc.lz4 file. It has mozJSSCLz40v001
file header and maybe some sc
packaging to pack group of files to on byte stream.
There is a Firefox addon to read or compress .mozlz4 text files mozlz4-edit
add a comment |
Actually almost all Firefox profile lz4 files are mozlz4 files. It means they have the same "file format header".
Except one file. I talk about webext.sc.lz4 file. It has mozJSSCLz40v001
file header and maybe some sc
packaging to pack group of files to on byte stream.
There is a Firefox addon to read or compress .mozlz4 text files mozlz4-edit
Actually almost all Firefox profile lz4 files are mozlz4 files. It means they have the same "file format header".
Except one file. I talk about webext.sc.lz4 file. It has mozJSSCLz40v001
file header and maybe some sc
packaging to pack group of files to on byte stream.
There is a Firefox addon to read or compress .mozlz4 text files mozlz4-edit
edited Aug 6 '18 at 15:19
hlovdal
5125 silver badges9 bronze badges
5125 silver badges9 bronze badges
answered Mar 24 '18 at 19:18
user282490
add a comment |
add a comment |
Sufficiently persistent Googling for this turns up a lot of solutions, but most of them seem to be either (a) broken by subsequent changes to underlying libraries, or (b) unnecessarily complex (at least to my personal taste), making them clunky to drop into existing code.
The following appears to work at least on Python 2.7 and 3.6 using a recent version of the Python LZ4 bindings:
def mozlz4_to_text(filepath):
# Given the path to a "mozlz4", "jsonlz4", "baklz4" etc. file,
# return the uncompressed text.
import lz4.block
bytestream = open(filepath, "rb")
bytestream.read(8) # skip past the b"mozLz40" header
valid_bytes = bytestream.read()
text = lz4.block.decompress(valid_bytes)
return text
Of course this does not attempt to validate inputs (or outputs), is not intended to be secure, etc., but if one just wants to be able to parse one's own FF data, it gets the basic job done.
Command line version here, which could be saved in the relevant directory and invoked from the command line as:
chmod +x mozlz4.py
./mozlz4.py <file you want to read> <file to save output to>
add a comment |
Sufficiently persistent Googling for this turns up a lot of solutions, but most of them seem to be either (a) broken by subsequent changes to underlying libraries, or (b) unnecessarily complex (at least to my personal taste), making them clunky to drop into existing code.
The following appears to work at least on Python 2.7 and 3.6 using a recent version of the Python LZ4 bindings:
def mozlz4_to_text(filepath):
# Given the path to a "mozlz4", "jsonlz4", "baklz4" etc. file,
# return the uncompressed text.
import lz4.block
bytestream = open(filepath, "rb")
bytestream.read(8) # skip past the b"mozLz40" header
valid_bytes = bytestream.read()
text = lz4.block.decompress(valid_bytes)
return text
Of course this does not attempt to validate inputs (or outputs), is not intended to be secure, etc., but if one just wants to be able to parse one's own FF data, it gets the basic job done.
Command line version here, which could be saved in the relevant directory and invoked from the command line as:
chmod +x mozlz4.py
./mozlz4.py <file you want to read> <file to save output to>
add a comment |
Sufficiently persistent Googling for this turns up a lot of solutions, but most of them seem to be either (a) broken by subsequent changes to underlying libraries, or (b) unnecessarily complex (at least to my personal taste), making them clunky to drop into existing code.
The following appears to work at least on Python 2.7 and 3.6 using a recent version of the Python LZ4 bindings:
def mozlz4_to_text(filepath):
# Given the path to a "mozlz4", "jsonlz4", "baklz4" etc. file,
# return the uncompressed text.
import lz4.block
bytestream = open(filepath, "rb")
bytestream.read(8) # skip past the b"mozLz40" header
valid_bytes = bytestream.read()
text = lz4.block.decompress(valid_bytes)
return text
Of course this does not attempt to validate inputs (or outputs), is not intended to be secure, etc., but if one just wants to be able to parse one's own FF data, it gets the basic job done.
Command line version here, which could be saved in the relevant directory and invoked from the command line as:
chmod +x mozlz4.py
./mozlz4.py <file you want to read> <file to save output to>
Sufficiently persistent Googling for this turns up a lot of solutions, but most of them seem to be either (a) broken by subsequent changes to underlying libraries, or (b) unnecessarily complex (at least to my personal taste), making them clunky to drop into existing code.
The following appears to work at least on Python 2.7 and 3.6 using a recent version of the Python LZ4 bindings:
def mozlz4_to_text(filepath):
# Given the path to a "mozlz4", "jsonlz4", "baklz4" etc. file,
# return the uncompressed text.
import lz4.block
bytestream = open(filepath, "rb")
bytestream.read(8) # skip past the b"mozLz40" header
valid_bytes = bytestream.read()
text = lz4.block.decompress(valid_bytes)
return text
Of course this does not attempt to validate inputs (or outputs), is not intended to be secure, etc., but if one just wants to be able to parse one's own FF data, it gets the basic job done.
Command line version here, which could be saved in the relevant directory and invoked from the command line as:
chmod +x mozlz4.py
./mozlz4.py <file you want to read> <file to save output to>
answered Jan 31 at 6:53
Samuel HendersonSamuel Henderson
312 bronze badges
312 bronze badges
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f326897%2fhow-to-decompress-jsonlz4-files-firefox-bookmark-backups-using-the-command-lin%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Cross reference: Reading "jsonlz4" bookmarkbackup files • mozillaZine Forums (2014-11-04)
– Graham Perrin
Oct 19 '17 at 1:28