Page Contents
Home > @loopback/openapi-v3 > response > file
response.file variable
Decorate the response as a file
Signature:
file: (...mediaTypes: string[]) => MethodDecorator
Example
import {oas, get, param} from '@loopback/openapi-v3';
import {RestBindings, Response} from '@loopback/rest';
class MyController {
@get('/files/{filename}')
@oas.response.file('image/jpeg', 'image/png')
download(
@param.path.string('filename') fileName: string,
@inject(RestBindings.Http.RESPONSE) response: Response,
) {
// use response.download(...);
}
}