filesaver-jetpack

0.0.1 • Public • Published

filesaver-jetpack

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

To use

  1. Install it:
```bash
$ npm i filesaver-jetpack
```
  1. Import it and use:
```js
var FileSaver = require('filesaver-jetpack');
var fs = new FileSaver({title: 'Save a File',
                        fileExtension: '.txt'});
fs.save('File content to be written');
```

FileSaver(opts)

opts should be an object with 3 optional properties.

title - Title of the filesaver dialog box.

fileFilter - Refer Filter constants

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

save(data)

Opens the save dialog box and writes the passes data to a file. If no data is passed, it returns the path of save file selected.

data - Data to be written to the 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

Package Sidebar

Install

npm i filesaver-jetpack

Weekly Downloads

0

Version

0.0.1

License

MPL

Last publish

Collaborators

  • darkowlzz