forked from nestjs/nest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.controller.ts
39 lines (32 loc) 路 958 Bytes
/
app.controller.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import { Controller, Get, StreamableFile } from '@nestjs/common';
import { Observable } from 'rxjs';
import { AppService } from './app.service';
import { NonFile } from './non-file';
@Controller()
export class AppController {
constructor(private readonly appService: AppService) {}
@Get('file/stream')
getFile(): StreamableFile {
return this.appService.getReadStream();
}
@Get('file/buffer')
getBuffer(): StreamableFile {
return this.appService.getBuffer();
}
@Get('non-file/pipe-method')
getNonFile(): NonFile {
return this.appService.getNonFile();
}
@Get('file/rxjs/stream')
getRxJSFile(): Observable<StreamableFile> {
return this.appService.getRxJSFile();
}
@Get('file/with/headers')
getFileWithHeaders(): StreamableFile {
return this.appService.getFileWithHeaders();
}
@Get('file/not/exist')
getNonExistantFile(): StreamableFile {
return this.appService.getFileThatDoesNotExist();
}
}