0.0.1 • Published 9 years ago

filepicker-jetpack v0.0.1

Weekly downloads
2
License
MPL
Repository
github
Last release
9 years ago

filepicker-jetpack

Quickly create filepicker in firefox add-ons (jpm based).

To use

  1. Install it:

    $ npm i filepicker-jetpack
  2. Import it and use:

    var FilePicker = require('filepicker-jetpack');
    var fp = new FilePicker({fileExtension: '.txt',
                             title: 'Text file picker'});
    var fileContent = fp.open('data');

FilePicker(opts)

opts should be an object with 3 optional properties.

fileFilter - Refer Filter constants

fileExtension - Extension of the file to pick, like '.txt'.

title - Title of the file picker dialog box.

open(resultType)

resultType specifies the type of result to be returned.

'data' - would return file content of the selected file.

'path' - would return path of the selected file.

Test it

Clone the repo and run npm install inside the repo to install all the dependencies. Prepare for testing by running npm test. cd into jpmTest/ and run jpm run -b /path/to/firefox-nightly.

Example, in OS X

$ jpm run -b /Applications/Nightly.app

This works only in firefox nightly, like jpm.

LICENSE

MPL