mirror of
https://github.com/overleaf/overleaf.git
synced 2024-10-24 21:12:38 -04:00
487d9125a2
GitOrigin-RevId: de4c512a62d304b3eeb2a1521aac173fa93d8411
23 lines
624 B
JavaScript
23 lines
624 B
JavaScript
const OutputFileArchiveManager = require('./OutputFileArchiveManager')
|
|
const { expressify } = require('@overleaf/promise-utils')
|
|
const { pipeline } = require('node:stream/promises')
|
|
|
|
async function createOutputZip(req, res) {
|
|
const {
|
|
project_id: projectId,
|
|
user_id: userId,
|
|
build_id: buildId,
|
|
} = req.params
|
|
|
|
const archive = await OutputFileArchiveManager.archiveFilesForBuild(
|
|
projectId,
|
|
userId,
|
|
buildId
|
|
)
|
|
|
|
res.attachment('output.zip')
|
|
res.setHeader('X-Content-Type-Options', 'nosniff')
|
|
await pipeline(archive, res)
|
|
}
|
|
|
|
module.exports = { createOutputZip: expressify(createOutputZip) }
|