How to use @tsed/multipartfiles - 2 common examples

To help you get started, we’ve selected a few @tsed/multipartfiles examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github TypedProject / ts-express-decorators / test / integration / app / controllers / calendars / CalendarCtrl.ts View on Github external
@Header("x-token-test", "test")
  @Header("x-token-test-2", "test2")
  @Status(200)
  @ContentType("application/xml")
  @Deprecated()
  testResponseHeader(@Request() request: Express.Request) {
    return "";
  }

  @Post("/documents")
  testMultipart(@MultipartFile("files") files: any[]) {
    return files;
  }

  @Post("/documents/1")
  @MulterFileSize(2048)
  testMultipart2(@MultipartFile("file1") file: any) {
    console.log("====>", file);

    return "DONE";
  }
}
github TypedProject / ts-express-decorators / examples / multer / src / controllers / upload / UploadCtrl.ts View on Github external
import {Controller, Put, Status} from "@tsed/common";
import {MulterOptions, MultipartFile} from "@tsed/multipartfiles";
import {Responses} from "@tsed/swagger";

@Controller("/upload")
export class UploadController {

  constructor() {
  }

  @Put("/")
  @Status(201)
  @Responses("201", {description: "Created"})
  @Responses("400", {description: "Bad Request"})
  @MulterOptions({dest: `${process.cwd()}/.tmp`})
  async add(@MultipartFile("file") file: Express.Multer.File): Promise {

    console.log("file: ", file);

    return true;
  }
}

@tsed/multipartfiles

Multer package for Ts.ED framework

MIT
Latest version published 4 years ago

Package Health Score

53 / 100
Full package analysis

Similar packages