generated from privateOmega/ts-project-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample.js
61 lines (54 loc) · 1.39 KB
/
example.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import { createWriteStream } from 'fs';
import { join } from 'path';
import StreamArchiver from '../src';
const zipStream = createWriteStream(join(__dirname, './example.zip'));
const files = [
{
fileNameWithExt: '1.dcm',
url: 'http://medistim.com/wp-content/uploads/2016/07/ttfm.dcm',
},
{
fileNameWithExt: '2.dcm',
url: 'http://medistim.com/wp-content/uploads/2016/07/bmode.dcm',
},
{
fileNameWithExt: '3.dcm',
url: 'http://medistim.com/wp-content/uploads/2016/07/bmode_privatetags.dcm',
},
{
fileNameWithExt: '4.dcm',
url: 'http://medistim.com/wp-content/uploads/2016/07/ttfm.dcm',
},
{
fileNameWithExt: '5.dcm',
url: 'http://medistim.com/wp-content/uploads/2016/07/bmode.dcm',
},
{
fileNameWithExt: '6.dcm',
url: 'http://medistim.com/wp-content/uploads/2016/07/bmode_privatetags.dcm',
},
{
fileNameWithExt: '7.dcm',
url: 'http://medistim.com/wp-content/uploads/2016/07/ttfm.dcm',
},
{
fileNameWithExt: '8.dcm',
url: 'http://medistim.com/wp-content/uploads/2016/07/bmode.dcm',
},
{
fileNameWithExt: '9.dcm',
url: 'http://medistim.com/wp-content/uploads/2016/07/bmode_privatetags.dcm',
},
];
const streamArchiver = new StreamArchiver(
'zip',
undefined,
4,
[{ stream: zipStream }],
files,
true
);
(async () => {
await streamArchiver.process();
console.log('\nGenerated an archive');
})();