Skip to content

Commit

Permalink
feat: ability to define zip compression level
Browse files Browse the repository at this point in the history
  • Loading branch information
stonith404 committed Jul 22, 2023
1 parent 389dc87 commit 7827b68
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
7 changes: 4 additions & 3 deletions backend/prisma/seed/config.seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ const configVariables: ConfigVariables = {
appUrl: {
type: "string",
defaultValue: "http://localhost:3000",

secret: false,
},
showHomePage: {
Expand All @@ -36,15 +35,17 @@ const configVariables: ConfigVariables = {
allowUnauthenticatedShares: {
type: "boolean",
defaultValue: "false",

secret: false,
},
maxSize: {
type: "number",
defaultValue: "1000000000",

secret: false,
},
zipCompressionLevel: {
type: "number",
defaultValue: "9",
},
},
email: {
enableShareEmailRecipients: {
Expand Down
2 changes: 1 addition & 1 deletion backend/src/share/share.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export class ShareService {

const files = await this.prisma.file.findMany({ where: { shareId } });
const archive = archiver("zip", {
zlib: { level: 9 },
zlib: { level: this.config.get("share.zipCompressionLevel") },
});
const writeStream = fs.createWriteStream(`${path}/archive.zip`);

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/share/DownloadAllButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const DownloadAllButton = ({ shareId }: { shareId: string }) => {
}
}}
>
<FormattedMessage id="share.download-all" />
<FormattedMessage id="share.button.download-all" />
</Button>
);
};
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/i18n/translations/en-US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,9 @@ export default {
"Whether unauthenticated users can create shares",
"admin.config.share.max-size": "Max size",
"admin.config.share.max-size.description": "Maximum share size in bytes",
"admin.config.share.zip-compression-level": "Zip compression level",
"admin.config.share.zip-compression-level.description":
"Adjust the level to balance between file size and compression speed. Valid values range from 0 to 9, with 0 being no compression and 9 being maximum compression. ",

"admin.config.smtp.enabled": "Enabled",
"admin.config.smtp.enabled.description":
Expand Down

0 comments on commit 7827b68

Please sign in to comment.