File tree Expand file tree Collapse file tree 2 files changed +20
-5
lines changed Expand file tree Collapse file tree 2 files changed +20
-5
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " angular-file-saver" ,
3- "version" : " 0.0.1 " ,
3+ "version" : " 0.0.2 " ,
44 "main" : [
55 " src/file-saver.js"
66 ],
Original file line number Diff line number Diff line change 3737 return true ;
3838 }
3939
40+ //If browser does not suport Blob natively, but the object passed as
41+ //first argument represented as BlobBuilder polyfill instance
4042 if ( ! blobSupport && data instanceof BlobBuilder ) {
4143 return true ;
4244 }
4951 }
5052
5153 return {
52- saveFile : function ( filename , settings ) {
53- var data = settings . data ;
54- var type = settings . options ;
5554
55+ /**
56+ * saveFile - Immediately starts saving a file, returns undefined.
57+ *
58+ * @param {string|array|object } data Data, represented as a string,
59+ * an array or a Blob object;
60+ * @param {string } filename
61+ * @param {object } options Set of options for the Blob constructor.
62+ * Optional parameter, if Blob object is passed as first argument
63+ * @return {undefined }
64+ */
65+
66+ saveFile : function ( data , filename , options ) {
67+ var blob ;
68+ options = ( typeof options === 'undefined' ) ? { } : options ;
5669
5770 if ( isBlobInstance ( data ) ) {
5871 return saveAs ( data , filename ) ;
5972 }
6073
61- var blob = blobInit ( data , type ) ;
74+ data = data instanceof Array ? data : [ data ] ;
75+
76+ blob = blobInit ( data , options ) ;
6277
6378 return saveAs ( blob , filename ) ;
6479 }
You can’t perform that action at this time.
0 commit comments