{"id":18291783,"url":"https://github.com/blazity/nest-file-fastify","last_synced_at":"2025-04-05T10:31:04.758Z","repository":{"id":45473352,"uuid":"412403429","full_name":"Blazity/nest-file-fastify","owner":"Blazity","description":"Fastify-Multipart decorators for Nest.js","archived":false,"fork":false,"pushed_at":"2023-12-15T02:19:10.000Z","size":84,"stargazers_count":46,"open_issues_count":6,"forks_count":23,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-21T03:05:07.635Z","etag":null,"topics":["fastify","fastify-multipart","file","multipart","nest","nestjs","upload"],"latest_commit_sha":null,"homepage":"https://blazity.com/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Blazity.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-10-01T09:21:43.000Z","updated_at":"2025-02-28T08:38:46.000Z","dependencies_parsed_at":"2023-01-27T06:31:56.312Z","dependency_job_id":null,"html_url":"https://github.com/Blazity/nest-file-fastify","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Blazity%2Fnest-file-fastify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Blazity%2Fnest-file-fastify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Blazity%2Fnest-file-fastify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Blazity%2Fnest-file-fastify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Blazity","download_url":"https://codeload.github.com/Blazity/nest-file-fastify/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247324574,"owners_count":20920676,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fastify","fastify-multipart","file","multipart","nest","nestjs","upload"],"created_at":"2024-11-05T14:15:12.231Z","updated_at":"2025-04-05T10:31:04.325Z","avatar_url":"https://github.com/Blazity.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"left\"\u003e\n  \u003ch1\u003e fastify-multipart for Nest.js\u003c/h1\u003e\n\n[![Github Actions](https://img.shields.io/github/workflow/status/blazity/nest-file-fastify/Build?style=flat-square)](https://github.com/Blazity/nest-file-fastify)\n[![NPM](https://img.shields.io/npm/v/@blazity/nest-file-fastify.svg?style=flat-square)](https://www.npmjs.com/package/@blazity/nest-file-fastify)\n[![NPM](https://img.shields.io/npm/dm/@blazity/nest-file-fastify?style=flat-square)](https://www.npmjs.com/package/@blazity/nest-file-fastify)\n\n\u003c/div\u003e\n\nThis library adds decorators for [Nest.js](https://github.com/nestjs/nest) to support [@fastify/multipart](https://github.com/fastify/fastify-multipart). The API is very similar to the official Nest.js Express file decorators.\n\n## Installation\n\nNPM\n\n```bash\n$ npm install @blazity/nest-file-fastify @fastify/multipart\n```\n\nYarn\n\n```bash\n$ yarn add @blazity/nest-file-fastify @fastify/multipart\n```\n\nand register multpart plugin in your Nest.js application\n\n```typescript\nimport fastyfyMultipart from '@fastify/multipart';\n\n...\n\napp.register(fastyfyMultipart);\n```\n\n## Docs\n\n### Single file\n\n```ts\nimport { FileInterceptor, UploadedFile, MemoryStorageFile } from '@blazity/nest-file-fastify';\n\n@Post('upload')\n@UseInterceptors(FileInterceptor('file'))\nuploadFile(@UploadedFile() file: MemoryStorageFile) {\n  console.log(file);\n}\n```\n\n`FileInterceptor` arguments:\n\n- `fieldname`: string - name of the field that holds a file\n\n- `options`: optional object of type [`UploadOptions`](src/multipart/options.ts#L4)\n\n### Array of files\n\n```ts\nimport { FilesInterceptor, UploadedFiles, MemoryStorageFile } from '@blazity/nest-file-fastify';\n\n@Post('upload')\n@UseInterceptors(FilesInterceptor('files'))\nuploadFile(@UploadedFiles() files: MemoryStorageFile[]) {\n  console.log(files);\n}\n```\n\n`FilesInterceptor` arguments:\n\n- `fieldname`: string - name of the field that holds files\n\n- `maxCount`: optional number - maximum number of files to accept\n\n- `options`: optional object of type [`UploadOptions`](src/multipart/options.ts#L4)\n\n### Multiple files\n\n```ts\nimport { FileFieldsInterceptor, UploadedFiles, MemoryStorageFile } from '@blazity/nest-file-fastify';\n\n@Post('upload')\n@UseInterceptors(FileFieldsInterceptor([\n  { name: 'avatar', maxCount: 1 },\n  { name: 'background', maxCount: 1 },\n]))\nuploadFile(@UploadedFiles() files: { avatar?: MemoryStorageFile[], background?: MemoryStorageFile[] }) {\n  console.log(files);\n}\n```\n\n`FileFieldsInterceptor` arguments:\n\n- `uploadFields`: object of type [`UploadField`](src/multipart/handlers/file-fields.ts#L10)\n\n- `options`: optional object of type [`UploadOptions`](src/multipart/options.ts#L4)\n\n### Any files\n\n```ts\nimport { AnyFilesInterceptor, UploadedFiles, MemoryStorageFile } from '@blazity/nest-file-fastify';\n\n@Post('upload')\n@UseInterceptors(AnyFilesInterceptor()\nuploadFile(@UploadedFiles() files: MemoryStorageFile[]) {\n  console.log(files);\n}\n```\n\n`AnyFilesInterceptor` arguments:\n\n- `options`: optional object of type [`UploadOptions`](src/multipart/options.ts#L4)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblazity%2Fnest-file-fastify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblazity%2Fnest-file-fastify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblazity%2Fnest-file-fastify/lists"}