var result = JSON.stringify(localStorage,"", 4),
obj = {
"filename": "localStorage.json",
"url": 'data:application/json;charset=utf-8,' + encodeURIComponent(result),
"conflictAction": "prompt",
"saveAs": true
};
chrome.downloads.download(obj);