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