Advertisement
Guest User

Untitled

a guest
Jul 20th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. function download(idx) {
  2. chrome.storage.local.get([`${idx}`], function(items) { // null implies all items
  3. // Convert object to a string.
  4. var result = items[`${idx}`];
  5.  
  6. console.log(result.substr(0, 1000));
  7.  
  8. // Save as file
  9. var url = 'data:text/html;base64,' + btoa(unescape(encodeURIComponent(result)));
  10. chrome.downloads.download({
  11. url: url,
  12. filename: `page_${idx}.html`
  13. });
  14. });
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement