import { Injectable } from '@angular/core' ; import * as FileSaver from 'file-saver' ; @ Injectable ( ) export class DownloaderService { constructor ( ) { } downloadFile ( filename , content , filetype ) { let blob = new Blob ( [ content ] , { type : filetype } ) ; FileSaver . saveAs ( blob , filename ) ; } downloadXliffFile ( filename , content ) { this . downloadFile ( filename , content , 'application/xml' ) ; } }