Quickly create filepicker in firefox add-ons (jpm based).
- Install it:
```bash
$ npm i filepicker-jetpack
```
- Import it and use:
```js
var FilePicker = require('filepicker-jetpack');
var fp = new FilePicker({fileExtension: '.txt',
title: 'Text file picker'});
var fileContent = fp.open('data');
```
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 the filepicker.
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.
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, on OS X
$ jpm run -b /Applications/Nightly.app
This works only in firefox nightly, like jpm.
MPL