Skip to content

Commit 1ea2a30

Browse files
author
Philipp Alferov
committed
Change API
1 parent 342397f commit 1ea2a30

11 files changed

+542
-373
lines changed

dist/angular-file-saver.bundle.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -507,9 +507,9 @@ angular.module('ngFileSaver', [])
507507

508508
module.exports = function FileSaver(Blob, SaveAs, FileSaverUtils) {
509509

510-
function save(blob, filename) {
510+
function save(blob, filename, disableAutoBOM) {
511511
try {
512-
SaveAs(blob, filename);
512+
SaveAs(blob, filename, disableAutoBOM);
513513
} catch(err) {
514514
FileSaverUtils.handleErrors(err.message);
515515
}
@@ -523,17 +523,15 @@ module.exports = function FileSaver(Blob, SaveAs, FileSaverUtils) {
523523
*
524524
* @name saveAs
525525
* @function
526-
* @param {Object} options Set of options such as filename and data.
527-
* - `filename` (String): Custom filename (extension is optional).
528-
* - `data` (Blob): A Blob instance.
526+
* @param {Blob} data A Blob instance
527+
* @param {Object} filename Custom filename (extension is optional)
528+
* @param {Boolean} disableAutoBOM Disable automatically provided Unicode
529+
* text encoding hints
529530
*
530531
* @return {Undefined}
531532
*/
532533

533-
saveAs: function(options) {
534-
options = angular.extend({}, options);
535-
var data = options.data;
536-
var filename = options.filename;
534+
saveAs: function(data, filename, disableAutoBOM) {
537535

538536
if (!FileSaverUtils.isBlobInstance(data)) {
539537
FileSaverUtils.handleErrors('Data argument should be a blob instance');
@@ -543,7 +541,7 @@ module.exports = function FileSaver(Blob, SaveAs, FileSaverUtils) {
543541
FileSaverUtils.handleErrors('Filename argument should be a string');
544542
}
545543

546-
return save(data, filename);
544+
return save(data, filename, disableAutoBOM);
547545
}
548546
};
549547
};

dist/angular-file-saver.bundle.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/angular-file-saver.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ angular.module('ngFileSaver', [])
2222

2323
module.exports = function FileSaver(Blob, SaveAs, FileSaverUtils) {
2424

25-
function save(blob, filename) {
25+
function save(blob, filename, disableAutoBOM) {
2626
try {
27-
SaveAs(blob, filename);
27+
SaveAs(blob, filename, disableAutoBOM);
2828
} catch(err) {
2929
FileSaverUtils.handleErrors(err.message);
3030
}
@@ -38,17 +38,15 @@ module.exports = function FileSaver(Blob, SaveAs, FileSaverUtils) {
3838
*
3939
* @name saveAs
4040
* @function
41-
* @param {Object} options Set of options such as filename and data.
42-
* - `filename` (String): Custom filename (extension is optional).
43-
* - `data` (Blob): A Blob instance.
41+
* @param {Blob} data A Blob instance
42+
* @param {Object} filename Custom filename (extension is optional)
43+
* @param {Boolean} disableAutoBOM Disable automatically provided Unicode
44+
* text encoding hints
4445
*
4546
* @return {Undefined}
4647
*/
4748

48-
saveAs: function(options) {
49-
options = angular.extend({}, options);
50-
var data = options.data;
51-
var filename = options.filename;
49+
saveAs: function(data, filename, disableAutoBOM) {
5250

5351
if (!FileSaverUtils.isBlobInstance(data)) {
5452
FileSaverUtils.handleErrors('Data argument should be a blob instance');
@@ -58,7 +56,7 @@ module.exports = function FileSaver(Blob, SaveAs, FileSaverUtils) {
5856
FileSaverUtils.handleErrors('Filename argument should be a string');
5957
}
6058

61-
return save(data, filename);
59+
return save(data, filename, disableAutoBOM);
6260
}
6361
};
6462
};

0 commit comments

Comments
 (0)