mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-02-26 08:53:21 +00:00
fix: use pipeline instead of pipe
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
import { promisify } from "util";
|
||||
import * as express from "express";
|
||||
import * as stream from "stream";
|
||||
import config from "../../config";
|
||||
|
||||
import * as db from "../database/database";
|
||||
|
||||
import { getRepo, handleError } from "./route-utils";
|
||||
|
||||
const router = express.Router();
|
||||
@@ -14,13 +16,14 @@ router.get(
|
||||
const repo = await getRepo(req, res);
|
||||
if (!repo) return;
|
||||
|
||||
const pipeline = promisify(stream.pipeline);
|
||||
|
||||
try {
|
||||
res.attachment(`${repo.repoId}.zip`);
|
||||
|
||||
// ache the file for 6 hours
|
||||
// cache the file for 6 hours
|
||||
res.header("Cache-Control", "max-age=21600000");
|
||||
|
||||
repo.zip().pipe(res);
|
||||
await pipeline(repo.zip(), res)
|
||||
} catch (error) {
|
||||
handleError(error, res);
|
||||
}
|
||||
@@ -61,7 +64,6 @@ router.get(
|
||||
await repo.updateIfNeeded();
|
||||
}
|
||||
|
||||
|
||||
let download = false;
|
||||
const conference = await repo.conference();
|
||||
if (conference) {
|
||||
|
||||
Reference in New Issue
Block a user