0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-04-08 02:52:39 -05:00

Updated method call syntax for @tryghost/zip@1.0.0

- @tryghost/zip 1.0.0 has a totally different API, but it works the same
- This updates to use the new API
This commit is contained in:
Hannah Wolfe 2020-04-07 16:50:51 +01:00 committed by Hannah Wolfe
parent 26dfc02d48
commit 646a49039e

View file

@ -3,7 +3,7 @@ var fs = require('fs-extra'),
path = require('path'),
config = require('../../../server/config'),
security = require('../../../server/lib/security'),
{zipFolder} = require('@tryghost/zip'),
{compress} = require('@tryghost/zip'),
LocalFileStorage = require('../../../server/adapters/storage/LocalFileStorage');
/**
@ -34,13 +34,13 @@ class ThemeStorage extends LocalFileStorage {
fs.ensureDir(zipBasePath)
.then(function () {
return zipFolder(themePath, zipPath);
return compress(themePath, zipPath);
})
.then(function (length) {
.then(function (result) {
res.set({
'Content-disposition': 'attachment; filename={themeName}.zip'.replace('{themeName}', themeName),
'Content-Type': 'application/zip',
'Content-Length': length
'Content-Length': result.size
});
stream = fs.createReadStream(zipPath);