Skip to content

Commit

Permalink
fix: update did not output binary files correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
cbartel-ci committed Nov 28, 2021
1 parent 5ad9ae5 commit 3d30952
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions server/src/admin/admin.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,18 +71,18 @@ export class AdminService {
return new Promise((resolve) => {
const extract = tar.extract();
extract.on('entry', (header, stream, next) => {
let data = '';
const data = [];

stream.on('data', (chunk) => {
if (header.type === 'file') {
data += chunk;
data.push(chunk);
}
});

stream.on('end', () => {
if (header.type === 'file') {
const filePath = `${process.cwd()}/${header.name}`;
fs.outputFileSync(filePath, data);
fs.outputFileSync(filePath, Buffer.concat(data));
console.log(`updated: ${header.name}`);
}
next();
Expand Down

0 comments on commit 3d30952

Please sign in to comment.