Skip to content

Commit

Permalink
fix npm run java-server
Browse files Browse the repository at this point in the history
  • Loading branch information
kliu-stripe committed Aug 13, 2024
1 parent 90f673a commit 87eb0e2
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions src/stripeJavaLanguageServer/extractServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,27 @@ function downloadAndUntarLatestServerFile() {
function untarServerFile() {
console.log('Untar started...');

fs.createReadStream(tarFile).pipe(zlib.createGunzip()).pipe(tar.extract(extractTo));
// remove the downloaded tar file to minimize extension size
fs.unlinkSync(tarFile);

console.log('Untar finished.');
return new Promise<void>((resolve, reject) => {
fs.createReadStream(tarFile)
.pipe(zlib.createGunzip())
.pipe(tar.extract(extractTo))
.on('finish', () => {
console.log('Extraction finished.');
fs.unlink(tarFile, (error: any) => {
if (error) {
console.error('Error deleting tar file:', error);
reject(error);
} else {
console.log('Tar file deleted successfully');
resolve();
}
});
})
.on('error', (error: any) => {
console.error('Error during extraction:', error);
reject(error);
});
});
}

function getDownloadedDateStamp(file: string) {
Expand Down

0 comments on commit 87eb0e2

Please sign in to comment.