Reputation: 432
I want to develop an addon with the addon builder. I read that with simple storage one can have about 5 megabytes for his addon, but 5 mgb won't do it for my app. I need more. What could I do?
Upvotes: 4
Views: 677
Reputation: 57651
You cannot do much given the Add-on SDK API. Instead you could break out of the sandbox and create a file in user's profile directory (see File I/O code snippets). E.g. something along these lines to read the file myData.txt
from user's profile:
var {Cu, components} = require("chrome");
var {FileUtils} = Cu.import("resource://gre/modules/FileUtils.jsm");
var {NetUtils} = Cu.import("resource://gre/modules/NetUtil.jsm");
var file = FileUtils.getFile("ProfD", ["myData.txt"]);
NetUtil.asyncFetch(file, function(inputStream, status) {
if (!components.isSuccessCode(status)) {
// Handle error!
return;
}
// The file data is contained within inputStream.
// You can read it into a string with
var data = NetUtil.readInputStreamToString(inputStream, inputStream.available());
console.log(data);
});
Note that the unusual syntax to import modules is due to bug 683217.
Upvotes: 3