Skip to content

Instantly share code, notes, and snippets.

@erezsh
Created November 25, 2021 22:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erezsh/cf4d260bbd60e52cf13eb5468157a1ff to your computer and use it in GitHub Desktop.
Save erezsh/cf4d260bbd60e52cf13eb5468157a1ff to your computer and use it in GitHub Desktop.
function downloadToFile(content, filename, contentType) {
const a = document.createElement('a');
const file = new Blob([content], {type: contentType});
a.href= URL.createObjectURL(file);
a.download = filename;
a.click();
URL.revokeObjectURL(a.href);
};
bookmark_list = bookmarks.getAll().map(x=>({_id: x.url, description: x.title, tags: x.tags, updated: x.updated, created: x.updated, starred: true}))
json = JSON.stringify({
"app": "totalrecall",
"version": "1",
"data": bookmark_list,
}, null, 2)
downloadToFile(json, 'old_totalrecall_backup.json', 'text/json')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment