I am beginner in Angular 4. I have refer lots of Links for generate Zip
file but I can not get proper solution.
Is it possible to generate Zip file in Angu
Install library
$ npm install --save npm install jszip
In a file tsconfig.json
{"compilerOptions": {"paths": {
"jszip": ["../node_modules/jszip/dist/jszip.min.js"]
}}}
In a file demo.component.ts
import { saveAs, encodeBase64 } from '@progress/kendo-file-saver';
import * as JSZip from 'jszip';
Function on demo.component.ts
downloadFileExample() {
const jszip = new JSZip();
jszip.file('Hello.txt', 'Hello World\n');
jszip.generateAsync({ type: 'blob' }).then(function(content) {
// see FileSaver.js
saveAs(content, 'example.zip');
});
}
This example is with Angular 6.