1/*
2 This code comes from Vincent Lab
3 And it has a video version linked here: https://www.youtube.com/watch?v=fFhB2PYVDzQ
4*/
5
6// Import dependencies
7const decompress = require("decompress");
8const path = require("path");
9
10(async () => {
11
12 try {
13 const files = await decompress("unicorn.zip", "dist", {
14 filter: file => path.extname(file.path) !== ".exe"
15 });
16 console.log(files);
17 } catch (error) {
18 console.log(error);
19 }
20
21})();
22
23// decompress("unicorn.zip", "dist").then(files => {
24// console.log("done!");
25// });
26
27
28// // Filter out files before extracting
29// try {
30// const files = await decompress("unicorn.zip", "dist", {
31// filter: file => path.extname(file.path) !== ".exe"
32// });
33// console.log("done!");
34// } catch (error) {
35// console.log(error);
36// }
37
38
39// // Map files before extracting
40// try {
41// const files = await decompress("unicorn.zip", "dist", {
42// map: file => {
43// file.path = `unicorn-${file.path}`;
44// return file;
45// }
46// });
47// console.log("done!");
48// } catch (error) {
49// console.log(error);
50// }