Answer the question
In order to leave comments, you need to log in
How to create and write files in JavaScript from Chrome Extension?
Hi all. I had a problem: I need to perform fairly simple actions - create and write files to the specified path, but it is also possible in chrome storage, from a script in chrome extension. The problem is that a couple of hours in Google did not give any result - there are some complicated options everywhere, like creating an additional Chrome app and messaging with it. Is there a less complicated way? I'm already very tired, although all I want is to save data for myself, it's not clear why this is so difficult.
Thanks in advance.
Answer the question
In order to leave comments, you need to log in
Everything is perfectly saved via chrome.downloads.download
As an example, save the full localStorage extension
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);
I'm already very tired, although all I want is to save data for myself, it's not clear why this is so difficult.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question