ngx-filesaver
Advanced tools
Comparing version 8.0.0 to 8.1.0
@@ -45,11 +45,12 @@ (function (global, factory) { | ||
}; | ||
FileSaverService.prototype.save = function (blob, fileName, filtType) { | ||
FileSaverService.prototype.save = function (blob, fileName, filtType, option) { | ||
if (!blob) { | ||
throw new Error('Muse spcify blod argument'); | ||
throw new Error('Data argument should be a blob instance'); | ||
} | ||
fileSaver.saveAs(new Blob([blob], { type: filtType || blob.type || this.genType(fileName) }), decodeURI(fileName || 'download')); | ||
var file = new Blob([blob], { type: filtType || blob.type || this.genType(fileName) }); | ||
fileSaver.saveAs(file, decodeURI(fileName || 'download'), option); | ||
}; | ||
FileSaverService.prototype.saveText = function (txt, fileName) { | ||
FileSaverService.prototype.saveText = function (txt, fileName, option) { | ||
var blob = new Blob([txt]); | ||
this.save(blob, fileName); | ||
this.save(blob, fileName, null, option); | ||
}; | ||
@@ -113,3 +114,3 @@ FileSaverService.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function FileSaverService_Factory() { return new FileSaverService(); }, token: FileSaverService, providedIn: "root" }); | ||
} | ||
_this.fss.save(res.body, _this.getName(res)); | ||
_this.fss.save(res.body, _this.getName(res), null, _this.fsOptions); | ||
_this.success.emit(res); | ||
@@ -123,2 +124,7 @@ }, function (err) { return _this.error.emit(err); }, function () { return _this.setDisabled(false); }); | ||
}; | ||
FileSaverDirective.ctorParameters = function () { return [ | ||
{ type: core.ElementRef }, | ||
{ type: FileSaverService }, | ||
{ type: http.HttpClient } | ||
]; }; | ||
__decorate$1([ | ||
@@ -149,2 +155,6 @@ core.Input(), | ||
__decorate$1([ | ||
core.Input(), | ||
__metadata("design:type", Object) | ||
], FileSaverDirective.prototype, "fsOptions", void 0); | ||
__decorate$1([ | ||
core.Output(), | ||
@@ -151,0 +161,0 @@ __metadata("design:type", Object) |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("file-saver"),require("@angular/common/http"),require("rxjs")):"function"==typeof define&&define.amd?define("ngxFileSaver",["exports","@angular/core","file-saver","@angular/common/http","rxjs"],t):t((e=e||self).ngxFileSaver={},e.ng.core,e.saveAs,e.ng.common.http,e.rxjs)}(this,function(e,t,r,n,o){"use strict";var i=this&&this.__decorate||function(e,t,r,n){var o,i=arguments.length,s=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,r,s):o(t,r))||s);return i>3&&s&&Object.defineProperty(t,r,s),s},s=function(){function e(){}return Object.defineProperty(e.prototype,"isFileSaverSupported",{get:function(){try{return!!new Blob}catch(e){return!1}},enumerable:!0,configurable:!0}),e.prototype.genType=function(e){if(!e||-1===e.lastIndexOf("."))return"text/plain";var t=e.substr(e.lastIndexOf(".")+1);switch(t){case"txt":return"text/plain";case"xml":case"html":return"text/"+t;case"json":return"octet/stream";default:return"application/"+t}},e.prototype.save=function(e,t,n){if(!e)throw new Error("Muse spcify blod argument");r.saveAs(new Blob([e],{type:n||e.type||this.genType(t)}),decodeURI(t||"download"))},e.prototype.saveText=function(e,t){var r=new Blob([e]);this.save(r,t)},e.ngInjectableDef=t.ɵɵdefineInjectable({factory:function(){return new e},token:e,providedIn:"root"}),e=i([t.Injectable({providedIn:"root"})],e)}(),a=this&&this.__decorate||function(e,t,r,n){var o,i=arguments.length,s=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,r,s):o(t,r))||s);return i>3&&s&&Object.defineProperty(t,r,s),s},c=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},p=function(){function e(e,r,n){this.el=e,this.fss=r,this.httpClient=n,this.method="GET",this.success=new t.EventEmitter,this.error=new t.EventEmitter,r.isFileSaverSupported||e.nativeElement.classList.add("filesaver__not-support")}return e.prototype.getName=function(e){return decodeURI(this.fileName||e.headers.get("filename")||e.headers.get("x-filename"))},e.prototype._click=function(){var e=this;if(this.fss.isFileSaverSupported){var t=this.http;if(!t){var r=new n.HttpParams,o=this.query||{};for(var i in o)r.set(i,o[i]);t=this.httpClient.request(this.method,this.url,{observe:"response",responseType:"blob",headers:this.header,params:r})}this.setDisabled(!0),t.subscribe(function(t){200!==t.status||t.body.size<=0?e.error.emit(t):(e.fss.save(t.body,e.getName(t)),e.success.emit(t))},function(t){return e.error.emit(t)},function(){return e.setDisabled(!1)})}},e.prototype.setDisabled=function(e){var t=this.el.nativeElement;t.disabled=e,t.classList[e?"add":"remove"]("filesaver__disabled")},a([t.Input(),c("design:type",Object)],e.prototype,"method",void 0),a([t.Input(),c("design:type",o.Observable)],e.prototype,"http",void 0),a([t.Input(),c("design:type",Object)],e.prototype,"query",void 0),a([t.Input(),c("design:type",Object)],e.prototype,"header",void 0),a([t.Input(),c("design:type",String)],e.prototype,"url",void 0),a([t.Input(),c("design:type",String)],e.prototype,"fileName",void 0),a([t.Output(),c("design:type",Object)],e.prototype,"success",void 0),a([t.Output(),c("design:type",Object)],e.prototype,"error",void 0),a([t.HostListener("click"),c("design:type",Function),c("design:paramtypes",[]),c("design:returntype",void 0)],e.prototype,"_click",null),e=a([t.Directive({selector:"[fileSaver]",exportAs:"fileSaver"}),c("design:paramtypes",[t.ElementRef,s,n.HttpClient])],e)}(),l=this&&this.__decorate||function(e,t,r,n){var o,i=arguments.length,s=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,r,s):o(t,r))||s);return i>3&&s&&Object.defineProperty(t,r,s),s},u=function(){function e(){}return e=l([t.NgModule({declarations:[p],exports:[p]})],e)}();e.FileSaverDirective=p,e.FileSaverModule=u,e.FileSaverService=s,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("file-saver"),require("@angular/common/http"),require("rxjs")):"function"==typeof define&&define.amd?define("ngxFileSaver",["exports","@angular/core","file-saver","@angular/common/http","rxjs"],t):t((e=e||self).ngxFileSaver={},e.ng.core,e.saveAs,e.ng.common.http,e.rxjs)}(this,(function(e,t,r,n,o){"use strict";var i=this&&this.__decorate||function(e,t,r,n){var o,i=arguments.length,s=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,r,s):o(t,r))||s);return i>3&&s&&Object.defineProperty(t,r,s),s},s=function(){function e(){}return Object.defineProperty(e.prototype,"isFileSaverSupported",{get:function(){try{return!!new Blob}catch(e){return!1}},enumerable:!0,configurable:!0}),e.prototype.genType=function(e){if(!e||-1===e.lastIndexOf("."))return"text/plain";var t=e.substr(e.lastIndexOf(".")+1);switch(t){case"txt":return"text/plain";case"xml":case"html":return"text/"+t;case"json":return"octet/stream";default:return"application/"+t}},e.prototype.save=function(e,t,n,o){if(!e)throw new Error("Data argument should be a blob instance");var i=new Blob([e],{type:n||e.type||this.genType(t)});r.saveAs(i,decodeURI(t||"download"),o)},e.prototype.saveText=function(e,t,r){var n=new Blob([e]);this.save(n,t,null,r)},e.ngInjectableDef=t.ɵɵdefineInjectable({factory:function(){return new e},token:e,providedIn:"root"}),e=i([t.Injectable({providedIn:"root"})],e)}(),a=this&&this.__decorate||function(e,t,r,n){var o,i=arguments.length,s=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,r,s):o(t,r))||s);return i>3&&s&&Object.defineProperty(t,r,s),s},p=this&&this.__metadata||function(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)},c=function(){function e(e,r,n){this.el=e,this.fss=r,this.httpClient=n,this.method="GET",this.success=new t.EventEmitter,this.error=new t.EventEmitter,r.isFileSaverSupported||e.nativeElement.classList.add("filesaver__not-support")}return e.prototype.getName=function(e){return decodeURI(this.fileName||e.headers.get("filename")||e.headers.get("x-filename"))},e.prototype._click=function(){var e=this;if(this.fss.isFileSaverSupported){var t=this.http;if(!t){var r=new n.HttpParams,o=this.query||{};for(var i in o)r.set(i,o[i]);t=this.httpClient.request(this.method,this.url,{observe:"response",responseType:"blob",headers:this.header,params:r})}this.setDisabled(!0),t.subscribe((function(t){200!==t.status||t.body.size<=0?e.error.emit(t):(e.fss.save(t.body,e.getName(t),null,e.fsOptions),e.success.emit(t))}),(function(t){return e.error.emit(t)}),(function(){return e.setDisabled(!1)}))}},e.prototype.setDisabled=function(e){var t=this.el.nativeElement;t.disabled=e,t.classList[e?"add":"remove"]("filesaver__disabled")},e.ctorParameters=function(){return[{type:t.ElementRef},{type:s},{type:n.HttpClient}]},a([t.Input(),p("design:type",Object)],e.prototype,"method",void 0),a([t.Input(),p("design:type",o.Observable)],e.prototype,"http",void 0),a([t.Input(),p("design:type",Object)],e.prototype,"query",void 0),a([t.Input(),p("design:type",Object)],e.prototype,"header",void 0),a([t.Input(),p("design:type",String)],e.prototype,"url",void 0),a([t.Input(),p("design:type",String)],e.prototype,"fileName",void 0),a([t.Input(),p("design:type",Object)],e.prototype,"fsOptions",void 0),a([t.Output(),p("design:type",Object)],e.prototype,"success",void 0),a([t.Output(),p("design:type",Object)],e.prototype,"error",void 0),a([t.HostListener("click"),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",void 0)],e.prototype,"_click",null),e=a([t.Directive({selector:"[fileSaver]",exportAs:"fileSaver"}),p("design:paramtypes",[t.ElementRef,s,n.HttpClient])],e)}(),l=this&&this.__decorate||function(e,t,r,n){var o,i=arguments.length,s=i<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,r,s):o(t,r))||s);return i>3&&s&&Object.defineProperty(t,r,s),s},u=function(){function e(){}return e=l([t.NgModule({declarations:[c],exports:[c]})],e)}();e.FileSaverDirective=c,e.FileSaverModule=u,e.FileSaverService=s,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=ngx-filesaver.umd.min.js.map |
@@ -11,3 +11,3 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
import { Directive, ElementRef, Input, HostListener, EventEmitter, Output } from '@angular/core'; | ||
import { HttpClient, HttpParams } from '@angular/common/http'; | ||
import { HttpClient, HttpParams, HttpResponse } from '@angular/common/http'; | ||
import { Observable } from 'rxjs'; | ||
@@ -55,3 +55,3 @@ import { FileSaverService } from './filesaver.service'; | ||
} | ||
this.fss.save(res.body, this.getName(res)); | ||
this.fss.save(res.body, this.getName(res), null, this.fsOptions); | ||
this.success.emit(res); | ||
@@ -66,2 +66,7 @@ }, err => this.error.emit(err), () => this.setDisabled(false)); | ||
}; | ||
FileSaverDirective.ctorParameters = () => [ | ||
{ type: ElementRef }, | ||
{ type: FileSaverService }, | ||
{ type: HttpClient } | ||
]; | ||
__decorate([ | ||
@@ -92,2 +97,6 @@ Input(), | ||
__decorate([ | ||
Input(), | ||
__metadata("design:type", Object) | ||
], FileSaverDirective.prototype, "fsOptions", void 0); | ||
__decorate([ | ||
Output(), | ||
@@ -114,2 +123,2 @@ __metadata("design:type", Object) | ||
export { FileSaverDirective }; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2Z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gIH1cbiAgICAgICAgdGhpcy5mc3Muc2F2ZShyZXMuYm9keSwgdGhpcy5nZXROYW1lKHJlcyksIG51bGwsIHRoaXMuZnNPcHRpb25zKTtcbiAgICAgICAgdGhpcy5zdWNjZXNzLmVtaXQocmVzKTtcbiAgICAgIH0sXG4gICAgICBlcnIgPT4gdGhpcy5lcnJvci5lbWl0KGVyciksXG4gICAgICAoKSA9PiB0aGlzLnNldERpc2FibGVkKGZhbHNlKSxcbiAgICApO1xuICB9XG5cbiAgcHJpdmF0ZSBzZXREaXNhYmxlZChzdGF0dXM6IGJvb2xlYW4pIHtcbiAgICBjb25zdCBlbCA9IHRoaXMuZWwubmF0aXZlRWxlbWVudDtcbiAgICBlbC5kaXNhYmxlZCA9IHN0YXR1cztcbiAgICBlbC5jbGFzc0xpc3Rbc3RhdHVzID8gJ2FkZCcgOiAncmVtb3ZlJ10oYGZpbGVzYXZlcl9fZGlzYWJsZWRgKTtcbiAgfVxufVxuIl19 |
@@ -36,11 +36,12 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
} | ||
save(blob, fileName, filtType) { | ||
save(blob, fileName, filtType, option) { | ||
if (!blob) { | ||
throw new Error('Muse spcify blod argument'); | ||
throw new Error('Data argument should be a blob instance'); | ||
} | ||
saveAs(new Blob([blob], { type: filtType || blob.type || this.genType(fileName) }), decodeURI(fileName || 'download')); | ||
const file = new Blob([blob], { type: filtType || blob.type || this.genType(fileName) }); | ||
saveAs(file, decodeURI(fileName || 'download'), option); | ||
} | ||
saveText(txt, fileName) { | ||
saveText(txt, fileName, option) { | ||
const blob = new Blob([txt]); | ||
this.save(blob, fileName); | ||
this.save(blob, fileName, null, option); | ||
} | ||
@@ -53,2 +54,2 @@ }; | ||
export { FileSaverService }; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmlsZXNhdmVyLnNlcnZpY2UuanMiLCJzb3VyY2VSb290Ijoibmc6Ly9uZ3gtZmlsZX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xvYiwgZmlsZU5hbWU/OiBzdHJpbmcsIGZpbHRUeXBlPzogc3RyaW5nLCBvcHRpb24/OiBGaWxlU2F2ZXJPcHRpb25zKTogdm9pZCB7XG4gICAgaWYgKCFibG9iKSB7XG4gICAgICB0aHJvdyBuZXcgRXJyb3IoJ0RhdGEgYXJndW1lbnQgc2hvdWxkIGJlIGEgYmxvYiBpbnN0YW5jZScpO1xuICAgIH1cblxuICAgIGNvbnN0IGZpbGUgPSBuZXcgQmxvYihbYmxvYl0sIHsgdHlwZTogZmlsdFR5cGUgfHwgYmxvYi50eXBlIHx8IHRoaXMuZ2VuVHlwZShmaWxlTmFtZSkgfSk7XG4gICAgc2F2ZUFzKGZpbGUsIGRlY29kZVVSSShmaWxlTmFtZSB8fCAnZG93bmxvYWQnKSwgb3B0aW9uKTtcbiAgfVxuXG4gIHNhdmVUZXh0KHR4dDogc3RyaW5nLCBmaWxlTmFtZT86IHN0cmluZywgb3B0aW9uPzogRmlsZVNhdmVyT3B0aW9ucyk6IHZvaWQge1xuICAgIGNvbnN0IGJsb2IgPSBuZXcgQmxvYihbdHh0XSk7XG4gICAgdGhpcy5zYXZlKGJsb2IsIGZpbGVOYW1lLCBudWxsLCBvcHRpb24pO1xuICB9XG59XG4iXX0= |
@@ -11,3 +11,3 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
import { Directive, ElementRef, Input, HostListener, EventEmitter, Output } from '@angular/core'; | ||
import { HttpClient, HttpParams } from '@angular/common/http'; | ||
import { HttpClient, HttpParams, HttpResponse } from '@angular/common/http'; | ||
import { Observable } from 'rxjs'; | ||
@@ -56,3 +56,3 @@ import { FileSaverService } from './filesaver.service'; | ||
} | ||
_this.fss.save(res.body, _this.getName(res)); | ||
_this.fss.save(res.body, _this.getName(res), null, _this.fsOptions); | ||
_this.success.emit(res); | ||
@@ -66,2 +66,7 @@ }, function (err) { return _this.error.emit(err); }, function () { return _this.setDisabled(false); }); | ||
}; | ||
FileSaverDirective.ctorParameters = function () { return [ | ||
{ type: ElementRef }, | ||
{ type: FileSaverService }, | ||
{ type: HttpClient } | ||
]; }; | ||
__decorate([ | ||
@@ -92,2 +97,6 @@ Input(), | ||
__decorate([ | ||
Input(), | ||
__metadata("design:type", Object) | ||
], FileSaverDirective.prototype, "fsOptions", void 0); | ||
__decorate([ | ||
Output(), | ||
@@ -116,2 +125,2 @@ __metadata("design:type", Object) | ||
export { FileSaverDirective }; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmlsZXNhdmVyLmRpcmVjdGl2ZS5qcyIsInNvdXJjZVJvb3QiOiJuZzovL25neC1maWxlc2F2ZXIvIiwic291cmNlcyI6WyJzcmMvZmlsZXNhdmVyLmRpcmVjdGl2ZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7QUFBQSxPQUFPLEVBQUUsU0FBUyxFQUFFLFVBQVUsRUFBRSxLQUFLLEVBQUUsWUFBWSxFQUFFLFlBQVksRUFBRSxNQUFNLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFDakcsT0FBTyxFQUFFLFVBQVUsRUFBRSxVQUFVLEVBQWdCLE1BQU0sc0JBQXNCLENBQUM7QUFDNUUsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLE1BQU0sQ0FBQztBQUNsQyxPQUFPLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQztBQU12RDtJQVVFLDRCQUFvQixFQUFpQyxFQUFVLEdBQXFCLEVBQVUsVUFBc0I7UUFBaEcsT0FBRSxHQUFGLEVBQUUsQ0FBK0I7UUFBVSxRQUFHLEdBQUgsR0FBRyxDQUFrQjtRQUFVLGVBQVUsR0FBVixVQUFVLENBQVk7UUFUM0csV0FBTSxHQUFHLEtBQUssQ0FBQztRQU1MLFlBQU8sR0FBRyxJQUFJLFlBQVksRUFBc0IsQ0FBQztRQUNqRCxVQUFLLEdBQUcsSUFBSSxZQU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lc3BvbnNlJyxcbiAgICAgICAgcmVzcG9uc2VUeXBlOiAnYmxvYicsXG4gICAgICAgIGhlYWRlcnM6IHRoaXMuaGVhZGVyLFxuICAgICAgICBwYXJhbXMsXG4gICAgICB9KTtcbiAgICB9XG5cbiAgICB0aGlzLnNldERpc2FibGVkKHRydWUpO1xuICAgIHJlcS5zdWJzY3JpYmUoXG4gICAgICByZXMgPT4ge1xuICAgICAgICBpZiAocmVzLnN0YXR1cyAhPT0gMjAwIHx8IHJlcy5ib2R5LnNpemUgPD0gMCkge1xuICAgICAgICAgIHRoaXMuZXJyb3IuZW1pdChyZXMpO1xuICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuICAgICAgICB0aGlzLmZzcy5zYXZlKHJlcy5ib2R5LCB0aGlzLmdldE5hbWUocmVzKSwgbnVsbCwgdGhpcy5mc09wdGlvbnMpO1xuICAgICAgICB0aGlzLnN1Y2Nlc3MuZW1pdChyZXMpO1xuICAgICAgfSxcbiAgICAgIGVyciA9PiB0aGlzLmVycm9yLmVtaXQoZXJyKSxcbiAgICAgICgpID0+IHRoaXMuc2V0RGlzYWJsZWQoZmFsc2UpLFxuICAgICk7XG4gIH1cblxuICBwcml2YXRlIHNldERpc2FibGVkKHN0YXR1czogYm9vbGVhbikge1xuICAgIGNvbnN0IGVsID0gdGhpcy5lbC5uYXRpdmVFbGVtZW50O1xuICAgIGVsLmRpc2FibGVkID0gc3RhdHVzO1xuICAgIGVsLmNsYXNzTGlzdFtzdGF0dXMgPyAnYWRkJyA6ICdyZW1vdmUnXShgZmlsZXNhdmVyX19kaXNhYmxlZGApO1xuICB9XG59XG4iXX0= |
@@ -42,11 +42,12 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
}; | ||
FileSaverService.prototype.save = function (blob, fileName, filtType) { | ||
FileSaverService.prototype.save = function (blob, fileName, filtType, option) { | ||
if (!blob) { | ||
throw new Error('Muse spcify blod argument'); | ||
throw new Error('Data argument should be a blob instance'); | ||
} | ||
saveAs(new Blob([blob], { type: filtType || blob.type || this.genType(fileName) }), decodeURI(fileName || 'download')); | ||
var file = new Blob([blob], { type: filtType || blob.type || this.genType(fileName) }); | ||
saveAs(file, decodeURI(fileName || 'download'), option); | ||
}; | ||
FileSaverService.prototype.saveText = function (txt, fileName) { | ||
FileSaverService.prototype.saveText = function (txt, fileName, option) { | ||
var blob = new Blob([txt]); | ||
this.save(blob, fileName); | ||
this.save(blob, fileName, null, option); | ||
}; | ||
@@ -60,2 +61,2 @@ FileSaverService.ngInjectableDef = i0.ɵɵdefineInjectable({ factory: function FileSaverService_Factory() { return new FileSaverService(); }, token: FileSaverService, providedIn: "root" }); | ||
export { FileSaverService }; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmlsZXNhdmVyLnNlcnZpY2UuanMiLCJzb3VyY2VSb290Ijoibmc6Ly9uZ3gtZmlsZXNhdmVyLyIsInNvdXJjZXMiOlsic3JjL2ZpbGVzYXZlci5zZXJ2aWNlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7OztBQUFBLE9BQU8sRUFBRSxVQUFVLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFDM0MsT0FBTyxFQUFFLE1BQU0sRUFBRSxNQUFNLFlBQVksQ0FBQzs7QUFHcEM7SUFBQTtLQXVDQztJQXRDQyxzQkFBSSxrREFBb0I7YUFBeEI7WUFDRSxJQUFJO2dCQUNGLE9BQU8sQ0FBQyxDQUFDLElBQUksSUFBSSxFQUFFLENBQUM7YUFDckI7WUFBQyxPQUFPLENBQUMsRUFBRTtnQkFDVixPQUFPLEtBQUssQ0FBQzthQUNkO1FBQ0gsQ0FBQzs7O09BQUE7SUFFRCxrQ0FBTyxHQUFQLFVBQVEsUUFBaUI7UUFDdkIsSUFBSSxDQUFDLFFBQVEsSUFBSSxRQUFRLENBQUMsV0FBVyxDQUFDLEdBQUcsQ0FBQyxLQUFLLENBQUMsQ0FBQyx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ogdm9pZCB7XG4gICAgY29uc3QgYmxvYiA9IG5ldyBCbG9iKFt0eHRdKTtcbiAgICB0aGlzLnNhdmUoYmxvYiwgZmlsZU5hbWUsIG51bGwsIG9wdGlvbik7XG4gIH1cbn1cbiJdfQ== |
@@ -1,2 +0,2 @@ | ||
import { ɵɵdefineInjectable, Injectable, EventEmitter, Input, Output, HostListener, Directive, ElementRef, NgModule } from '@angular/core'; | ||
import { ɵɵdefineInjectable, Injectable, EventEmitter, ElementRef, Input, Output, HostListener, Directive, NgModule } from '@angular/core'; | ||
import { saveAs } from 'file-saver'; | ||
@@ -38,11 +38,12 @@ import { HttpParams, HttpClient } from '@angular/common/http'; | ||
} | ||
save(blob, fileName, filtType) { | ||
save(blob, fileName, filtType, option) { | ||
if (!blob) { | ||
throw new Error('Muse spcify blod argument'); | ||
throw new Error('Data argument should be a blob instance'); | ||
} | ||
saveAs(new Blob([blob], { type: filtType || blob.type || this.genType(fileName) }), decodeURI(fileName || 'download')); | ||
const file = new Blob([blob], { type: filtType || blob.type || this.genType(fileName) }); | ||
saveAs(file, decodeURI(fileName || 'download'), option); | ||
} | ||
saveText(txt, fileName) { | ||
saveText(txt, fileName, option) { | ||
const blob = new Blob([txt]); | ||
this.save(blob, fileName); | ||
this.save(blob, fileName, null, option); | ||
} | ||
@@ -104,3 +105,3 @@ }; | ||
} | ||
this.fss.save(res.body, this.getName(res)); | ||
this.fss.save(res.body, this.getName(res), null, this.fsOptions); | ||
this.success.emit(res); | ||
@@ -115,2 +116,7 @@ }, err => this.error.emit(err), () => this.setDisabled(false)); | ||
}; | ||
FileSaverDirective.ctorParameters = () => [ | ||
{ type: ElementRef }, | ||
{ type: FileSaverService }, | ||
{ type: HttpClient } | ||
]; | ||
__decorate$1([ | ||
@@ -141,2 +147,6 @@ Input(), | ||
__decorate$1([ | ||
Input(), | ||
__metadata("design:type", Object) | ||
], FileSaverDirective.prototype, "fsOptions", void 0); | ||
__decorate$1([ | ||
Output(), | ||
@@ -178,3 +188,7 @@ __metadata("design:type", Object) | ||
/** | ||
* Generated bundle index. Do not edit. | ||
*/ | ||
export { FileSaverDirective, FileSaverModule, FileSaverService }; | ||
//# sourceMappingURL=ngx-filesaver.js.map |
@@ -1,2 +0,2 @@ | ||
import { ɵɵdefineInjectable, Injectable, Input, Output, HostListener, Directive, ElementRef, EventEmitter, NgModule } from '@angular/core'; | ||
import { ɵɵdefineInjectable, Injectable, EventEmitter, ElementRef, Input, Output, HostListener, Directive, NgModule } from '@angular/core'; | ||
import { saveAs } from 'file-saver'; | ||
@@ -44,11 +44,12 @@ import { HttpParams, HttpClient } from '@angular/common/http'; | ||
}; | ||
FileSaverService.prototype.save = function (blob, fileName, filtType) { | ||
FileSaverService.prototype.save = function (blob, fileName, filtType, option) { | ||
if (!blob) { | ||
throw new Error('Muse spcify blod argument'); | ||
throw new Error('Data argument should be a blob instance'); | ||
} | ||
saveAs(new Blob([blob], { type: filtType || blob.type || this.genType(fileName) }), decodeURI(fileName || 'download')); | ||
var file = new Blob([blob], { type: filtType || blob.type || this.genType(fileName) }); | ||
saveAs(file, decodeURI(fileName || 'download'), option); | ||
}; | ||
FileSaverService.prototype.saveText = function (txt, fileName) { | ||
FileSaverService.prototype.saveText = function (txt, fileName, option) { | ||
var blob = new Blob([txt]); | ||
this.save(blob, fileName); | ||
this.save(blob, fileName, null, option); | ||
}; | ||
@@ -112,3 +113,3 @@ FileSaverService.ngInjectableDef = ɵɵdefineInjectable({ factory: function FileSaverService_Factory() { return new FileSaverService(); }, token: FileSaverService, providedIn: "root" }); | ||
} | ||
_this.fss.save(res.body, _this.getName(res)); | ||
_this.fss.save(res.body, _this.getName(res), null, _this.fsOptions); | ||
_this.success.emit(res); | ||
@@ -122,2 +123,7 @@ }, function (err) { return _this.error.emit(err); }, function () { return _this.setDisabled(false); }); | ||
}; | ||
FileSaverDirective.ctorParameters = function () { return [ | ||
{ type: ElementRef }, | ||
{ type: FileSaverService }, | ||
{ type: HttpClient } | ||
]; }; | ||
__decorate$1([ | ||
@@ -148,2 +154,6 @@ Input(), | ||
__decorate$1([ | ||
Input(), | ||
__metadata("design:type", Object) | ||
], FileSaverDirective.prototype, "fsOptions", void 0); | ||
__decorate$1([ | ||
Output(), | ||
@@ -190,3 +200,7 @@ __metadata("design:type", Object) | ||
/** | ||
* Generated bundle index. Do not edit. | ||
*/ | ||
export { FileSaverDirective, FileSaverModule, FileSaverService }; | ||
//# sourceMappingURL=ngx-filesaver.js.map |
@@ -1,1 +0,1 @@ | ||
{"__symbolic":"module","version":4,"metadata":{"FileSaverService":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":3,"character":1},"arguments":[{"providedIn":"root"}]}],"members":{"genType":[{"__symbolic":"method"}],"save":[{"__symbolic":"method"}],"saveText":[{"__symbolic":"method"}]},"statics":{"ngInjectableDef":{}}},"FileSaverDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":5,"character":1},"arguments":[{"selector":"[fileSaver]","exportAs":"fileSaver"}]}],"members":{"method":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":10,"character":3}}]}],"http":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":11,"character":3}}]}],"query":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":12,"character":3}}]}],"header":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":13,"character":3}}]}],"url":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":14,"character":3}}]}],"fileName":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":15,"character":3}}]}],"success":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":16,"character":3}}]}],"error":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":17,"character":3}}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"ElementRef","module":"@angular/core","arguments":[{"__symbolic":"error","message":"Could not resolve type","line":19,"character":37,"context":{"typeName":"HTMLButtonElement"},"module":"./src/filesaver.directive"}]},{"__symbolic":"reference","name":"FileSaverService"},{"__symbolic":"reference","module":"@angular/common/http","name":"HttpClient","line":19,"character":108}]}],"getName":[{"__symbolic":"method"}],"_click":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener","line":29,"character":3},"arguments":["click"]}]}],"setDisabled":[{"__symbolic":"method"}]}},"FileSaverModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":3,"character":1},"arguments":[{"declarations":[{"__symbolic":"reference","name":"FileSaverDirective"}],"exports":[{"__symbolic":"reference","name":"FileSaverDirective"}]}]}],"members":{}}},"origins":{"FileSaverService":"./src/filesaver.service","FileSaverDirective":"./src/filesaver.directive","FileSaverModule":"./src/filesaver.module"},"importAs":"ngx-filesaver"} | ||
{"__symbolic":"module","version":4,"metadata":{"FileSaverService":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Injectable","line":3,"character":1},"arguments":[{"providedIn":"root"}]}],"members":{"genType":[{"__symbolic":"method"}],"save":[{"__symbolic":"method"}],"saveText":[{"__symbolic":"method"}]},"statics":{"ngInjectableDef":{}}},"FileSaverDirective":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Directive","line":6,"character":1},"arguments":[{"selector":"[fileSaver]","exportAs":"fileSaver"}]}],"members":{"method":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":11,"character":3}}]}],"http":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":12,"character":3}}]}],"query":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":13,"character":3}}]}],"header":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":14,"character":3}}]}],"url":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":15,"character":3}}]}],"fileName":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":16,"character":3}}]}],"fsOptions":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Input","line":17,"character":3}}]}],"success":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":18,"character":3}}]}],"error":[{"__symbolic":"property","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"Output","line":19,"character":3}}]}],"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"ElementRef","module":"@angular/core","arguments":[{"__symbolic":"error","message":"Could not resolve type","line":21,"character":37,"context":{"typeName":"HTMLButtonElement"},"module":"./src/filesaver.directive"}]},{"__symbolic":"reference","name":"FileSaverService"},{"__symbolic":"reference","module":"@angular/common/http","name":"HttpClient","line":21,"character":108}]}],"getName":[{"__symbolic":"method"}],"_click":[{"__symbolic":"method","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"HostListener","line":31,"character":3},"arguments":["click"]}]}],"setDisabled":[{"__symbolic":"method"}]}},"FileSaverModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule","line":3,"character":1},"arguments":[{"declarations":[{"__symbolic":"reference","name":"FileSaverDirective"}],"exports":[{"__symbolic":"reference","name":"FileSaverDirective"}]}]}],"members":{}}},"origins":{"FileSaverService":"./src/filesaver.service","FileSaverDirective":"./src/filesaver.directive","FileSaverModule":"./src/filesaver.module"},"importAs":"ngx-filesaver"} |
{ | ||
"name": "ngx-filesaver", | ||
"version": "8.0.0", | ||
"version": "8.1.0", | ||
"description": "Simple file save with FileSaver.js", | ||
@@ -28,17 +28,17 @@ "repository": { | ||
"devDependencies": { | ||
"@angular/animations": "~8.0.1", | ||
"@angular/common": "~8.0.1", | ||
"@angular/compiler": "~8.0.1", | ||
"@angular/core": "~8.0.1", | ||
"@angular/forms": "~8.0.1", | ||
"@angular/platform-browser": "~8.0.1", | ||
"@angular/platform-browser-dynamic": "~8.0.1", | ||
"@angular/router": "~8.0.1", | ||
"@angular/animations": "~8.2.7", | ||
"@angular/common": "~8.2.7", | ||
"@angular/compiler": "~8.2.7", | ||
"@angular/core": "~8.2.7", | ||
"@angular/forms": "~8.2.7", | ||
"@angular/platform-browser": "~8.2.7", | ||
"@angular/platform-browser-dynamic": "~8.2.7", | ||
"@angular/router": "~8.2.7", | ||
"rxjs": "~6.4.0", | ||
"tslib": "^1.9.0", | ||
"tslib": "^1.10.0", | ||
"zone.js": "~0.9.1", | ||
"@angular-devkit/build-angular": "~0.800.0", | ||
"@angular/cli": "~8.0.3", | ||
"@angular/compiler-cli": "~8.0.1", | ||
"@angular/language-service": "~8.0.1", | ||
"@angular-devkit/build-angular": "~0.803.5", | ||
"@angular/cli": "~8.3.5", | ||
"@angular/compiler-cli": "~8.2.7", | ||
"@angular/language-service": "~8.2.7", | ||
"@types/node": "~8.9.4", | ||
@@ -58,8 +58,8 @@ "@types/jasmine": "~3.3.8", | ||
"tslint": "~5.15.0", | ||
"typescript": "~3.4.3", | ||
"ng-packagr": "^5.3.0", | ||
"typescript": "~3.5.3", | ||
"ng-packagr": "^5.7.0", | ||
"@types/file-saver": "^2.0.0", | ||
"file-saver": "^2.0.0", | ||
"gh-pages": "^2.0.1", | ||
"codecov": "^3.2.0" | ||
"gh-pages": "^2.1.1", | ||
"codecov": "^3.6.1" | ||
}, | ||
@@ -66,0 +66,0 @@ "main": "bundles/ngx-filesaver.umd.js", |
@@ -70,9 +70,10 @@ # ngx-filesaver | ||
----|------|-----|------ | ||
method | Request method type | `string` | `GET` | ||
url | Request URL | `string` | - | ||
fileName | Filename when downloading | `string` | - | ||
query | Additional query parameters. Equivalent to `params` value | `string` | - | ||
header | Header configuration. Usually used for especifying access tokens | `any` | - | ||
success | Download success callback | `EventEmitter<HttpResponse<Blob>>` | - | ||
error | Download error callback | `EventEmitter<any>` | - | ||
`method` | Request method type | `string` | `GET` | ||
`url` | Request URL | `string` | - | ||
`fileName` | Filename when downloading | `string` | - | ||
`query` | Additional query parameters. Equivalent to `params` value | `string` | - | ||
`header` | Header configuration. Usually used for especifying access tokens | `any` | - | ||
`fsOptions` | FileSaver.js config, can be set `autoBom` value | `FileSaverOptions` | - | ||
`success` | Download success callback | `EventEmitter<HttpResponse<Blob>>` | - | ||
`error` | Download error callback | `EventEmitter<any>` | - | ||
@@ -112,3 +113,3 @@ #### Custom HTTP type | ||
| --- | ---- | | ||
| `filesaver__not-support` | Not compatible with `Blob` | | ||
| `filesaver__not-support` | Not [Supported Browsers](https://github.com/eligrey/FileSaver.js/#supported-browsers) | | ||
| `filesaver__disabled` | During http request | |
@@ -68,9 +68,10 @@ # ngx-filesaver | ||
----|------|-----|------ | ||
method | 请求方法类型 | `string` | `GET` | ||
url | 下路路径 | `string` | - | ||
fileName | 文件名 | `string` | - | ||
query | 额外的查询参数,等同 `params` 值 | `string` | - | ||
header | 请求的 `headers` 属性值,一般用来指定 _token_ 之类 | `any` | - | ||
success | 下载成功回调 | `EventEmitter<HttpResponse<Blob>>` | - | ||
error | 下载错误回调 | `EventEmitter<any>` | - | ||
`method` | 请求方法类型 | `string` | `GET` | ||
`url` | 下路路径 | `string` | - | ||
`fileName` | 文件名 | `string` | - | ||
`query` | 额外的查询参数,等同 `params` 值 | `string` | - | ||
`header` | 请求的 `headers` 属性值,一般用来指定 _token_ 之类 | `any` | - | ||
`fsOptions` | FileSaver.js 配置,可以设置 `autoBom` 等参数值 | `FileSaverOptions` | - | ||
`success` | 下载成功回调 | `EventEmitter<HttpResponse<Blob>>` | - | ||
`error` | 下载错误回调 | `EventEmitter<any>` | - | ||
@@ -106,3 +107,3 @@ #### 自定义Http型 | ||
| --- | ---- | | ||
| `filesaver__not-support` | 不兼容 `Blob` 时 | | ||
| `filesaver__not-support` | 不 [兼容](https://github.com/eligrey/FileSaver.js/#supported-browsers) `Blob` 时 | | ||
| `filesaver__disabled` | 请求过程中 | |
import { ElementRef, EventEmitter } from '@angular/core'; | ||
import { HttpClient, HttpResponse } from '@angular/common/http'; | ||
import { Observable } from 'rxjs'; | ||
import { FileSaverOptions } from 'file-saver'; | ||
import { FileSaverService } from './filesaver.service'; | ||
@@ -15,2 +16,3 @@ export declare class FileSaverDirective { | ||
fileName: string; | ||
fsOptions: FileSaverOptions; | ||
readonly success: EventEmitter<HttpResponse<Blob>>; | ||
@@ -17,0 +19,0 @@ readonly error: EventEmitter<any>; |
@@ -0,6 +1,7 @@ | ||
import { FileSaverOptions } from 'file-saver'; | ||
export declare class FileSaverService { | ||
readonly isFileSaverSupported: boolean; | ||
genType(fileName?: string): string; | ||
save(blob: Blob, fileName?: string, filtType?: string): void; | ||
saveText(txt: string, fileName?: string): void; | ||
save(blob: Blob, fileName?: string, filtType?: string, option?: FileSaverOptions): void; | ||
saveText(txt: string, fileName?: string, option?: FileSaverOptions): void; | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
116430
1035
114
0