As I know , personal data always be saved at profile path which can be find at chrome://version.
I added many snippets in my Chrome Dev Tool, and want to backup them
On my ubuntu18
, chromium
snippets are saved under:
~/.config/chromium/Default/Preferences
as a one-line json file.
The above and Bookmarks
are the files I normally backup.
Note: I am using jq-1.6
for the commands below
To backup all snippetes into one json file:
jq .devtools.preferences.scriptSnippets ~/.config/chromium/Default/Preferences \
| jq '. | fromjson' > /tmp/backup.json
To backup all snippets into separate .js files
# Tested with jq-1.6
# The script converts json entries into lines of format
# `filename[TAB]content-in-base64` and then
# for each line creates the corresponding file
# with the content decoded.
# Better be in a safe directory!!
mkdir /tmp/snippets-backup
cd /tmp/snippets-backup
jq .devtools.preferences.scriptSnippets ~/.config/chromium/Default/Preferences \
| jq '. | fromjson | .[]| [ .name, @base64 "\(.content)" ] | @tsv' -r \
| xargs -I{} /bin/bash -c 'file=$(echo "{}"|cut -f1); fileContent=$(echo "{}"|cut -f2); echo "$fileContent" | base64 -d > "${file}.js"'
jq is a great command-line tool to query and process JSON files. You can get it from stedolan.github.io/jq/.