{"id":22192519,"url":"https://github.com/3sidedcube/nestjs-s3","last_synced_at":"2025-03-24T20:45:41.007Z","repository":{"id":232215371,"uuid":"480395468","full_name":"3sidedcube/nestjs-s3","owner":"3sidedcube","description":"S3 file upload helpers for NestJS","archived":false,"fork":false,"pushed_at":"2024-08-31T02:07:10.000Z","size":3176,"stargazers_count":0,"open_issues_count":10,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-30T01:22:28.457Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/3sidedcube.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-11T13:36:53.000Z","updated_at":"2024-04-08T13:25:43.000Z","dependencies_parsed_at":"2024-04-17T15:03:16.485Z","dependency_job_id":null,"html_url":"https://github.com/3sidedcube/nestjs-s3","commit_stats":null,"previous_names":["3sidedcube/nestjs-s3"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3sidedcube%2Fnestjs-s3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3sidedcube%2Fnestjs-s3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3sidedcube%2Fnestjs-s3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/3sidedcube%2Fnestjs-s3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/3sidedcube","download_url":"https://codeload.github.com/3sidedcube/nestjs-s3/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245351757,"owners_count":20601090,"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":[],"created_at":"2024-12-02T12:25:43.530Z","updated_at":"2025-03-24T20:45:40.983Z","avatar_url":"https://github.com/3sidedcube.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# S3\n\nGet signed URLs and delete hosted files via a queue\n\n### Installation\n\nThe project is hosted on our private npm registry, so to install simply run\n\n##### npm\n\n```bash\nnpm i @chelseaapps/s3\n```\n\n##### yarn\n\n```bash\nyarn add @chelseaapps/s3\n```\n\n#### Config options\n\n| Option      | Description                        | Example                                     |\n| ----------- | ---------------------------------- | ------------------------------------------- |\n| bucketName  | S3 bucket name                     | ca-media                                    |\n| bucketUrl   | URL of bucket (Without trailing /) | https://ca-media.s3.eu-west-2.amazonaws.com |\n| accessKeyId | S3 access key ID                   | RXIARTJAQWWNM3Q3QEXQ                        |\n| accessKey   | S3 access key                      | GTIARTJAQWWNM3Q3QEXQ                        |\n| region      | S3 Region                          | eu-west-2                                   |\n\nThe module can be configured in two ways:\n\n-   Regular\n-   Asynchronous\n\n### Usage\n\nImport the S3Service into a module using the Nest depedency injection mechanism.\n\n```typescript\nimport { S3Service } from \"@chelseaapps/s3\"\n\n@Injectable()\nexport class UserService {\n\tconstructor(\n\t\tprivate s3Service: S3Service,\n\t) {}\n\n    ...\n    async signedUrl() {\n        await this.s3Service.getSignedUrl(\"image.png\", \"image/png\")\n    }\n\n    async removeFile() {\n        // Array of file paths relative to the bucket. If it's in a directory, you must include the relative path (e.g directory/image.png)\n        await this.s3Service.removeFile([\"image.png\"])\n    }\n}\n```\n### S3Service API\n* `async getSignedUrl(fileName: string, fileType: string): Promise\u003c{ signedUrl: string; url: string }\u003e`\n  - Takes file name and the MIME type (http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17) of the file and returns an object with the `signedUrl` and the `url` which is a complete url location of the file in the bucket.\n\n* `async uploadFile(input: S3UploadFileDTO): Promise\u003cPutObjectCommandOutput\u003e`\n  - Takes an input DTO, which has the following parameters:\n    - `file` - The content of the file\n    - `key` - key for the file in the bucket\n    - `contentType` - MIME type for the file (http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17)\n    - `bucket` (optional) - overrides the default bbucket of the service defined in the config\n\n* `async removeFile(keys: string[]): Promise\u003cvoid\u003e`\n  - Takes a list of keys that point to the files that are required to be deleted in the bucket specified in the config.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F3sidedcube%2Fnestjs-s3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F3sidedcube%2Fnestjs-s3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F3sidedcube%2Fnestjs-s3/lists"}