Tip for Easily Backup Local Script Files in TruClient Lite Chrome

Currently TruClient Lite Chrome doesn’t support batch script operations. If the user want to back up all the local scripts, then they have to manually download the scripts one by one.
There are two ways to back up the scripts

  1. All the scripts are saved in the user data directory. So back up the user data directory will back up the script indirectly.
  2. We could use a hack way to download all the scripts as a single zip file.

Steps to back up user data folder

  1. Check the path from the command line of the shortcut of your TruClient Lite Chrome
    1. --user-data-dir=<profile dir> --extensions-on-chrome-urls --silent-debugger-extension-api --disable-web-security --no-first-run
  2. Back up the folder <profile dir>

Steps to download all the scripts as a single zip file

  1. Start the TruClient Lite
  2. Navigate to chrome://extensions/ to open the extension management pages for Chrome
  3. Check the Developer mode
    extension-enable-dev-mode
  4. Click background page link for TruClient Lite
    extension-page
  5. Run the below code on console, the scripts will be saved
    1. var zip = new JSZip(); localforage.iterate((v, k) => { if(k.startsWith('/__scripts__/') && k.indexOf(':metadata:') === -1){ zip.file(k.split('/').pop()+'.zip', v); } }).then(()=>{ a = document.createElement('a'); a.href = window.URL.createObjectURL(zip.generate({type:"blob"})); a.download = "scripts.zip"; a.dispatchEvent(new MouseEvent("click")); });
  6. Restart TruClient Lite

2 thoughts on “Tip for Easily Backup Local Script Files in TruClient Lite Chrome

Leave a Reply to Shang Erxin Cancel reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>