feat: Export collection as direct download instead of emailing (#1001)

* feat: Export collection as zip instead of emailing

* Flow typing download.js
This commit is contained in:
Tom Moor
2019-07-29 22:35:34 -07:00
committed by GitHub
parent c9b86ec2e7
commit 92a18159b5
8 changed files with 192 additions and 17 deletions

View File

@ -1,4 +1,5 @@
// @flow
import stream from 'stream';
import { type Context } from 'koa';
export default function apiWrapper() {
@ -10,7 +11,10 @@ export default function apiWrapper() {
const ok = ctx.status < 400;
if (typeof ctx.body !== 'string') {
if (
typeof ctx.body !== 'string' &&
!(ctx.body instanceof stream.Readable)
) {
// $FlowFixMe
ctx.body = {
...ctx.body,