Skip to content

Commit d13f28f

Browse files
author
Teddy Chambard
committed
Add StreamFile(s)Param decorators
1 parent 9df2ba0 commit d13f28f

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

src/decorators.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,26 @@ export function IsFloat(target: any, propertyKey: string, parameterIndex?: numbe
110110
export function IsDouble(target: any, propertyKey: string, parameterIndex?: number) {
111111
return;
112112
}
113+
114+
/**
115+
* Creates a mapping between a file on a multipart request and a method
116+
* argument.
117+
* Unlike @FileParam provided by typescript-rest, this decorator allows to pipe the request.
118+
*/
119+
export function StreamFileParam(name: string) {
120+
return function (...args: any[]) {
121+
return;
122+
};
123+
}
124+
125+
/**
126+
* Creates a mapping between multiple files on a multipart request and a method
127+
* argument.
128+
* Unlike @FileParam provided by typescript-rest, this decorator allows to pipe the request.
129+
*/
130+
export function StreamFilesParam(name: string) {
131+
return function (...args: any[]) {
132+
return;
133+
};
134+
}
135+

src/metadata/parameterGenerator.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ export class ParameterGenerator {
3131
return this.getFileParameter(this.parameter);
3232
case 'FilesParam':
3333
return this.getFilesParameter(this.parameter);
34+
case 'StreamFileParam':
35+
return this.getFileParameter(this.parameter);
36+
case 'StreamFilesParam':
37+
return this.getFilesParameter(this.parameter);
3438
case 'Context':
3539
case 'ContextRequest':
3640
case 'ContextResponse':

0 commit comments

Comments
 (0)