Reputation: 890
I would like to unzip files using typescript. I have test.ts like below
var unzip = require('unzip-stream');
var fs = require('fs-extra');
class test {
unzipp() {
return fs.createReadStream('./e2e/chrome.zip').pipe(unzip.Extract({ path: './e2e' }));
}
}
But when I run
tsc test.ts
and then
node test.js
nothing happens.
Can anyone help with that please?
Upvotes: 0
Views: 9917
Reputation: 30545
you have declared your class but you did not run it.
var myInstance = new test();
myInstance.unzipp();
Upvotes: 3
Reputation: 73029
As Patrick says in the comment, you're not actually running the code. You don't really need a class for this right now either. Try the following:
var unzip = require('unzip-stream');
var fs = require('fs-extra');
function unzip() {
return fs.createReadStream('./e2e/chrome.zip').pipe(unzip.Extract({ path: './e2e' }));
}
unzip();
Upvotes: 1