You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/techniques/streaming-files.md
+16-4Lines changed: 16 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -46,18 +46,30 @@ export class FileController {
46
46
}
47
47
```
48
48
49
-
The default content type is `application/octet-stream`, if you need to customize the response you can use the `res.set` method or the [`@Header()`](/controllers#headers) decorator, like this:
49
+
The default content type (the value for `Content-Type` HTTP response header) is `application/octet-stream`. If you need to customize this value you can use the `type` option from `StreamableFile`, or use the `res.set` method or the [`@Header()`](/controllers#headers) decorator, like this:
50
50
51
51
```ts
52
52
import { Controller, Get, StreamableFile, Res } from'@nestjs/common';
53
53
import { createReadStream } from'fs';
54
54
import { join } from'path';
55
-
importtype { Response } from'express';
55
+
importtype { Response } from'express';// Assuming that we are using the ExpressJS HTTP Adapter
0 commit comments