Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8546525
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:02:51+00:00 2026-06-11T13:02:51+00:00

Is there a way to access Html5 file api in Fire Fox addon sdk

  • 0

Is there a way to access Html5 file api in Fire Fox addon sdk in the content script?

This is needed in order to store user added words and their meanings. The data can grow large and so local storage isn’t an option.

 window.requestFileSystem3 = window.requestFileSystem || window.webkitRequestFileSystem;

gives me the error TypeError: window.requestFileSystem3 is not a function.

I am asking this because i am porting this code from a Google Chrome Extension which allows accessing the file api in a content script.

Additional Questions

1) If HTML5 File API is not allowed then should i use file module?

2) Does the file module allow access to any file on the file system as opposed to the Html5 file api which only access to a sandboxed access to file system?

3) Assuming i have to use file module what would be the best location to store my files ( like the user profile directory or extension directory ) and how would i get this path in code.

I apologize for so many sub questions inside this questions. Google wasn’t very helpful regarding this topic.

Any sample code would be very helpful.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T13:02:53+00:00Added an answer on June 11, 2026 at 1:02 pm

    Firefox doesn’t support writing files via File API yet and even when this will be added it will probably be accessible to web pages only and not extensions. In other words: yes, if you absolutely need to write to files then you should use low-level APIs. You want to store your data in the user profile directory (there is no extension directory, your extension is usually installed as a single packed file). Something like this should work to write a file:

    var file = require("sdk/io/file");
    var profilePath = require("sdk/system").pathFor("ProfD");
    var filePath = file.join(profilePath, "foo.txt");
    var writer = file.open(filePath, "w");
    writer.writeAsync("foo!", function(error)
    {
      if (error)
        console.log("Error: " + error);
      else
        console.log("Success!");
    });
    

    For reference: sdk/io/file, sdk/system

    You could use TextReader.read() or file.read() to read the file. Unfortunately, Add-on SDK doesn’t seem to support asynchronous file reading so the read will block the Firefox UI. The only alternative would be importing NetUtil and FileUtils via chrome authority, something like this:

    var {components, Cu} = require("chrome");
    var {NetUtil} = Cu.import("resource://gre/modules/NetUtil.jsm", null);
    var {FileUtils} = Cu.import("resource://gre/modules/FileUtils.jsm", null);
    NetUtil.asyncFetch(new FileUtils.File(filePath), function(stream, result)
    {
      if (components.isSuccessCode(result))
      {
        var data = NetUtil.readInputStreamToString(stream, stream.available());
        console.log("Success: " + data);
      }
      else
        console.log("Error: " + result);
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any way to access file's history using the data in the .svn
Is there a way to access domain objects in a groovy script? I've tried
Are there any way to access or set iphone's alarm? Im assuming if this
Is there a way to access the page HTML source code using javascript? I
Is there a way to access the local variable of a function from a
Is there a way to access the Dialer/Contacts/Call Log of Android through an application?
Is there a way to access SQLite results by column name (like a C++
Is there a way to access the http request IE made when the page
Is there any way to access the owning UITableView from within a UITableViewCell ?
Is there any way to access the iPhone/iPod touch settings programatically ? Thanks. Biranchi

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.