Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function download(idx) {
- chrome.storage.local.get([`${idx}`], function(items) { // null implies all items
- // Convert object to a string.
- var result = items[`${idx}`];
- console.log(result.substr(0, 1000));
- // Save as file
- var url = 'data:text/html;base64,' + btoa(unescape(encodeURIComponent(result)));
- chrome.downloads.download({
- url: url,
- filename: `page_${idx}.html`
- });
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement