UNPKG

@uppy/companion

Version:

OAuth helper and remote fetcher for Uppy's (https://uppy.io) extensible file upload widget with support for drag&drop, resumable uploads, previews, restrictions, file processing/encoding, remote providers like Dropbox and Google Drive, S3 and more :dog:

26 lines (25 loc) 633 B
import { respondWithError } from '../provider/error.js'; /** * * @param {object} req * @param {object} res */ async function thumbnail(req, res, next) { const { id } = req.params; const { provider, providerUserSession } = req.companion; try { const { stream, contentType } = await provider.thumbnail({ id, providerUserSession, }); if (contentType != null) res.set('Content-Type', contentType); stream.pipe(res); } catch (err) { if (respondWithError(err, res)) return; next(err); } } export default thumbnail;