{"id":18867933,"url":"https://github.com/hodfords-solutions/nestjs-storage","last_synced_at":"2025-04-09T09:05:05.027Z","repository":{"id":258067788,"uuid":"560871871","full_name":"hodfords-solutions/nestjs-storage","owner":"hodfords-solutions","description":"Provides integration with third-party cloud storage solutions in NestJS apps","archived":false,"fork":false,"pushed_at":"2025-03-18T07:51:24.000Z","size":656,"stargazers_count":45,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-04-02T08:06:01.897Z","etag":null,"topics":["aws-s3","azure-storage","nestjs","nodejs","storage"],"latest_commit_sha":null,"homepage":"https://opensource.hodfords.uk/nestjs-storage","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/hodfords-solutions.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-11-02T13:06:12.000Z","updated_at":"2025-03-18T07:50:16.000Z","dependencies_parsed_at":"2024-10-17T14:33:32.969Z","dependency_job_id":"f966c4a5-70d9-4bad-a363-321577fecc3b","html_url":"https://github.com/hodfords-solutions/nestjs-storage","commit_stats":{"total_commits":52,"total_committers":4,"mean_commits":13.0,"dds":0.6923076923076923,"last_synced_commit":"8929ca4290d439293ec00c5a5ff0ef5566db5477"},"previous_names":["hodfords-solutions/nestjs-storage"],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hodfords-solutions%2Fnestjs-storage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hodfords-solutions%2Fnestjs-storage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hodfords-solutions%2Fnestjs-storage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hodfords-solutions%2Fnestjs-storage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hodfords-solutions","download_url":"https://codeload.github.com/hodfords-solutions/nestjs-storage/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248008631,"owners_count":21032556,"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":["aws-s3","azure-storage","nestjs","nodejs","storage"],"created_at":"2024-11-08T05:11:54.598Z","updated_at":"2025-04-09T09:05:05.000Z","avatar_url":"https://github.com/hodfords-solutions.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"http://opensource.hodfords.uk\" target=\"blank\"\u003e\u003cimg src=\"https://opensource.hodfords.uk/img/logo.svg\" width=\"320\" alt=\"Nest Logo\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\nNestjs-Storage provides a powerful filesystem abstraction. The Nestjs-Storage integration provides simple drivers for working with local filesystems, Amazon S3, Azure. Even better, it's amazingly simple to switch between these storage options between your local development machine and production server as the API remains the same for each system.\n\u003c/p\u003e\n\n## Installation 🤖\nTo begin using it, we first install the required dependencies.\n```\nnpm install @hodfords/nestjs-storage\n```\n\n## Configuration 🚀\nTo activate storage, import the `StorageModule` into the root `AppModule` and run the `forRoot()` static method as shown below:\n\nAzure configuration:\n```typescript\nimport { Module } from '@nestjs/common';\nimport { StorageModule } from '@hodfords/nestjs-storage';\n\n@Module({\n    imports: [\n        StorageModule.forRoot({\n            account: {\n                name: env.AZURE.ACCOUNT_NAME,\n                key: env.AZURE.ACCOUNT_KEY,\n                containerName: env.AZURE.CONTAINER_NAME,\n                expiredIn: env.AZURE.SAS_EXPIRED_IN\n            },\n            disk: 'azure'\n        })\n    ],\n})\nexport class AppModule {}\n```\n\nAws S3 configuration:\n```typescript\nimport { Module } from '@nestjs/common';\nimport { StorageModule } from '@hodfords/nestjs-storage';\n\n@Module({\n    imports: [\n        StorageModule.forRoot({\n            account: {\n                name: env.AWS.API_KEY,\n                key: env.AWS.API_SECRET,\n                containerName: env.AWS.BUCKET,\n                expiredIn: env.AZURE.SAS_EXPIRED_IN,\n                region: env.AWS.REGION\n            },\n            disk: 's3'\n        })\n    ],\n})\nexport class AppModule {}\n```\n\n### Driver Prerequisites:\n- **Azure**: `npm install @azure/storage-blob`\n- **Aws S3**: `npm install @aws-sdk/client-s3 @aws-sdk/lib-storage @aws-sdk/s3-request-presigner`\n\n## Usage 🚀\n\nInject storage instance into your service or controller and use it as shown below:\n\n```typescript\nimport { StorageService } from \"@hodfords/nestjs-storage\";\n\n@Injectable()\nexport class AppService implements OnModuleInit {\n\n    constructor(private storageService: StorageService) {\n    }\n}\n```\n\n### Delete file\nThe delete method accepts a single filename\n\n```typescript\nawait this.storageService.deleteFile('path/to/file');\n```\n\nThis method may throw an exception if the file does not exist. You can ignore this exception by using the `deleteIfExists` method.\n\n```typescript\nawait this.storageService.deleteIfExists('path/to/file');\n```\n\n## License\nThis project is licensed under the MIT License\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhodfords-solutions%2Fnestjs-storage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhodfords-solutions%2Fnestjs-storage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhodfords-solutions%2Fnestjs-storage/lists"}