Skip to content

Commit

Permalink
Fix generating zip file
Browse files Browse the repository at this point in the history
  • Loading branch information
alexwarren committed Aug 13, 2024
1 parent 1bbf70f commit c91b8ef
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 18 deletions.
15 changes: 8 additions & 7 deletions compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,16 @@
var jquery = fs.readFileSync(jQueryPath);
zip.file(jqueryJs, jquery);
}
var buffer = zip.generate({
zip.generateAsync({
type: 'nodebuffer'
}).then(function (buffer) {
if (options.write) {
fs.writeFileSync(path.join(outputPath, 'output.zip'), buffer);
}
else {
options.result(buffer);
}
});
if (options.write) {
fs.writeFileSync(path.join(outputPath, 'output.zip'), buffer);
}
else {
return buffer;
}
}
}

Expand Down
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 8 additions & 6 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@ http.createServer(function(request, response) {
input: body,
write: false,
zip: true,
});
response.writeHead(200, {
'Content-Type': 'application/octet-stream',
'Access-Control-Allow-Origin': '*'
});
response.end(result, 'binary');
result: function(result) {
response.writeHead(200, {
'Content-Type': 'application/octet-stream',
'Access-Control-Allow-Origin': '*'
});
response.end(result, 'binary');
}
});
}
else {
result = compiler.getJs(body);
Expand Down

0 comments on commit c91b8ef

Please sign in to comment.