admin管理员组文章数量:1394196
I would like to know how is it possible to create custom file located in extension root directory using JavaScript or Chrome API.
Extension root directory looks like:
- popup.html
- popup.js
- manifest.json
- icon.png
And I would like to create JSON file called test in that root directory.
So after that it should look like:
- popup.html
- popup.js
- manifest.json
- icon.png
- test.json
test.json should contain:
{
"data": "123456789"
}
It is not duplicate, because that post is for File Dialog and I need to save it at fixed location and in extension folder. And as I said I want to create it, not download it.
I would like to know how is it possible to create custom file located in extension root directory using JavaScript or Chrome API.
Extension root directory looks like:
- popup.html
- popup.js
- manifest.json
- icon.png
And I would like to create JSON file called test in that root directory.
So after that it should look like:
- popup.html
- popup.js
- manifest.json
- icon.png
- test.json
test.json should contain:
{
"data": "123456789"
}
It is not duplicate, because that post is for File Dialog and I need to save it at fixed location and in extension folder. And as I said I want to create it, not download it.
Share Improve this question edited Jun 24, 2018 at 21:22 tomsk asked Jun 24, 2018 at 21:04 tomsktomsk 9974 gold badges15 silver badges31 bronze badges 3- Possible duplicate of JavaScript: Create and save file – Sheshank S. Commented Jun 24, 2018 at 21:12
- @SheshankS. No because it is for File Dialog, but I need to save it at fixed location and in extension folder. And as I said I want to create it, not download it. – tomsk Commented Jun 24, 2018 at 21:19
- Oh I see @tomsk – Sheshank S. Commented Jun 28, 2018 at 21:47
1 Answer
Reset to default 6You can't. The extension directory cannot be used for storage -- its contents are not synchronized across machines, and the directory is replaced entirely when the extension is upgraded.
If you need to store data in a Chrome extension, use the chrome.storage
API.
本文标签: javascriptCreate file in Chrome ExtensionsStack Overflow
版权声明:本文标题:javascript - Create file in Chrome Extensions - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744610217a2615610.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论