Total Complexity | 1 |
Complexity/F | 1 |
Lines of Code | 18 |
Function Count | 1 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | var path = require('path'); |
||
2 | var fs = require('fs'); |
||
3 | var JSZip = require("jszip"); |
||
4 | |||
5 | var zip = new JSZip(); |
||
6 | |||
7 | zip.file("Hello.txt", "Hello World\n"); |
||
8 | |||
9 | //var img = zip.folder("images"); |
||
10 | //img.file("smile.gif", imgData, {base64: true}); |
||
11 | |||
12 | zip.generateNodeStream({type:'nodebuffer',streamFiles:true}) |
||
13 | .pipe(fs.createWriteStream('example.zip')) |
||
14 | .on('finish', function () { |
||
15 | // JSZip generates a readable stream with a "end" event, |
||
16 | // but is piped here in a writable stream which emits a "finish" event. |
||
17 | console.log("example.zip written."); |
||
|
|||
18 | }); |
||
19 |