Skip to content

darkowlzz/filepicker-jetpack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

filepicker-jetpack

NPM

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

To use

  1. Install it:
```bash
$ npm i filepicker-jetpack
```
  1. 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');
```

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)

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.

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, on OS X

$ jpm run -b /Applications/Nightly.app

This works only in firefox nightly, like jpm.

LICENSE

MPL

About

Quick filepicker module for firefox jpm based add-ons.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published