{"_id":"@atmus/nestjs-storage","_rev":"2-4716da2cb66eca51f5f9192690bb4f54","name":"@atmus/nestjs-storage","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"@atmus/nestjs-storage","version":"1.0.0","keywords":["nestjs","storage","aws-s3","google-cloud-storage","azure-blob","local-storage"],"author":{"name":"Atmus Tecnologia","email":"contato@atmustecnologia.com.br"},"license":"MIT","_id":"@atmus/nestjs-storage@1.0.0","homepage":"https://github.com/atmus-tecnologia/nestjs-storage#readme","bugs":{"url":"https://github.com/atmus-tecnologia/nestjs-storage/issues"},"dist":{"shasum":"6809189421733526b6db62219c1558c32fdddca8","tarball":"https://registry.npmjs.org/@atmus/nestjs-storage/-/nestjs-storage-1.0.0.tgz","fileCount":23,"integrity":"sha512-Qo0u8q+8B0QEwl3zqy4bhkmTyfzeeEJU7+CGoZM1iwNHh6mZgiviXRbLO6KRWdY4rhzZZN+7r3U+QiNhbZ8zCw==","signatures":[{"sig":"MEQCIG9jg5LVFGbkAiC9oFzCmoIt6Rk6eR1rIRJZ4qG16HPGAiBQ/zzm63tINLdbpGpY1CgsBnbcBo+xvoe2XPcQviGdWQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":35584},"jest":{"roots":["src"],"testRegex":".*\\.spec\\.ts$","transform":{"^.+\\.(t|j)s$":"ts-jest"},"testEnvironment":"node","moduleNameMapper":{"src/(.*)":"<rootDir>/src/$1"},"coverageDirectory":"../coverage","moduleDirectories":["node_modules","src"],"collectCoverageFrom":["**/*.(t|j)s"],"moduleFileExtensions":["js","json","ts"]},"main":"dist/index.js","types":"./dist/index.d.ts","gitHead":"10f8c6e66389ac1ba4c39f0f03cd3766d2bc32d7","scripts":{"test":"jest","build":"nest build","deploy":"sh ./publish.sh","format":"prettier **/**/*.ts --ignore-path ./.prettierignore --write","prepare":"husky install"},"_npmUser":{"name":"fmedeiros","email":"medeiros.dev@gmail.com"},"precommit":["format","test"],"repository":{"url":"git+https://github.com/atmus-tecnologia/nestjs-storage.git","type":"git"},"_npmVersion":"10.8.1","description":"NestJS storage library supporting AWS S3, Google Cloud Storage, Azure Blob, and local storage.","directories":{},"_nodeVersion":"20.15.0","dependencies":{"mime-types":"^2.1.27","@nestjs/common":"^10.0.0","@nestjs/config":"^3.0.0","@aws-sdk/client-s3":"^3.0.0","@azure/storage-blob":"^12.0.0","@google-cloud/storage":"^5.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.5.0","husky":"^8.0.3","rimraf":"^4.4.1","ts-jest":"^29.0.5","ts-node":"^10.9.1","prettier":"^2.8.7","typescript":"^5.0.2","@types/jest":"^29.5.0","@types/node":"^20.3.1","lint-staged":"^13.2.0","@nestjs/core":"^10.0.0","@types/multer":"^1.4.11","@types/express":"^4.17.21","@nestjs/testing":"^10.0.0","reflect-metadata":"^0.1.13","standard-version":"^9.5.0","@typescript-eslint/parser":"^5.57.0","@typescript-eslint/eslint-plugin":"^5.57.0"},"peerDependencies":{"rxjs":"^7.2.0","@nestjs/common":"^10.0.0","@nestjs/config":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/nestjs-storage_1.0.0_1719676364081_0.27171533034019624","host":"s3://npm-registry-packages"}},"1.0.1":{"name":"@atmus/nestjs-storage","version":"1.0.1","keywords":["nestjs","storage","aws-s3","google-cloud-storage","azure-blob","local-storage"],"author":{"name":"Atmus Tecnologia","email":"contato@atmustecnologia.com.br"},"license":"MIT","_id":"@atmus/nestjs-storage@1.0.1","homepage":"https://github.com/atmus-tecnologia/nestjs-storage#readme","bugs":{"url":"https://github.com/atmus-tecnologia/nestjs-storage/issues"},"dist":{"shasum":"51ede2fbeb29ac393f5a56e84cac68d9591c0af8","tarball":"https://registry.npmjs.org/@atmus/nestjs-storage/-/nestjs-storage-1.0.1.tgz","fileCount":23,"integrity":"sha512-A+nXf+9Inzcere8nNK/aY/55X84SeVm9BJ+Rl9sLkBjtIuh8dOpe/YFohUMtaOSSWsuf1GEmwHbc0ySgWkvCaQ==","signatures":[{"sig":"MEUCIQDXAA1r7fuzm5xLMTxmYxV1XiVmO+DCnAptEfWdJ8mSmwIgCtAjUOawp8o/0ve0ptecc978JdvexlEWkV9kLKCx8QI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":35997},"jest":{"roots":["src"],"testRegex":".*\\.spec\\.ts$","transform":{"^.+\\.(t|j)s$":"ts-jest"},"testEnvironment":"node","moduleNameMapper":{"src/(.*)":"<rootDir>/src/$1"},"coverageDirectory":"../coverage","moduleDirectories":["node_modules","src"],"collectCoverageFrom":["**/*.(t|j)s"],"moduleFileExtensions":["js","json","ts"]},"main":"dist/index.js","types":"./dist/index.d.ts","gitHead":"ed9717245a2ac7c28238b4b555b16ca9436e6d0a","scripts":{"test":"jest","build":"nest build","deploy":"sh ./publish.sh","format":"prettier **/**/*.ts --ignore-path ./.prettierignore --write","prepare":"husky install"},"_npmUser":{"name":"fmedeiros","email":"medeiros.dev@gmail.com"},"precommit":["format","test"],"repository":{"url":"git+https://github.com/atmus-tecnologia/nestjs-storage.git","type":"git"},"_npmVersion":"10.8.1","description":"NestJS storage library supporting AWS S3, Google Cloud Storage, Azure Blob, and local storage.","directories":{},"_nodeVersion":"20.15.0","dependencies":{"mime-types":"^2.1.27","@nestjs/common":"^10.0.0","@nestjs/config":"^3.0.0","@aws-sdk/client-s3":"^3.0.0","@azure/storage-blob":"^12.0.0","@google-cloud/storage":"^5.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.5.0","husky":"^8.0.3","rimraf":"^4.4.1","ts-jest":"^29.0.5","ts-node":"^10.9.1","prettier":"^2.8.7","typescript":"^5.0.2","@types/jest":"^29.5.0","@types/node":"^20.3.1","lint-staged":"^13.2.0","@nestjs/core":"^10.0.0","@types/multer":"^1.4.11","@types/express":"^4.17.21","@nestjs/testing":"^10.0.0","reflect-metadata":"^0.1.13","standard-version":"^9.5.0","@typescript-eslint/parser":"^5.57.0","@typescript-eslint/eslint-plugin":"^5.57.0"},"peerDependencies":{"rxjs":"^7.2.0","@nestjs/common":"^10.0.0","@nestjs/config":"^3.0.0"},"_npmOperationalInternal":{"tmp":"tmp/nestjs-storage_1.0.1_1719678077521_0.567868034926587","host":"s3://npm-registry-packages"}},"1.0.2":{"name":"@atmus/nestjs-storage","version":"1.0.2","description":"NestJS storage library supporting AWS S3, Google Cloud Storage, Azure Blob, and local storage.","author":{"name":"Atmus Tecnologia","email":"contato@atmustecnologia.com.br"},"license":"MIT","main":"dist/index.js","scripts":{"build":"nest build","deploy":"sh ./publish.sh","prepare":"husky install","format":"prettier **/**/*.ts --ignore-path ./.prettierignore --write","test":"jest"},"precommit":["format","test"],"keywords":["nestjs","storage","aws-s3","google-cloud-storage","azure-blob","local-storage"],"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/atmus-tecnologia/nestjs-storage.git"},"bugs":{"url":"https://github.com/atmus-tecnologia/nestjs-storage/issues"},"peerDependencies":{"@nestjs/common":"^10.0.0","@nestjs/config":"^3.0.0","rxjs":"^7.2.0"},"dependencies":{"@aws-sdk/client-s3":"^3.0.0","@azure/storage-blob":"^12.0.0","@google-cloud/storage":"^5.0.0","@nestjs/common":"^10.0.0","@nestjs/config":"^3.0.0","mime-types":"^2.1.27"},"devDependencies":{"@nestjs/core":"^10.0.0","@nestjs/testing":"^10.0.0","@types/express":"^4.17.21","@types/jest":"^29.5.0","@types/multer":"^1.4.11","@types/node":"^20.3.1","@typescript-eslint/eslint-plugin":"^5.57.0","@typescript-eslint/parser":"^5.57.0","husky":"^8.0.3","jest":"^29.5.0","lint-staged":"^13.2.0","prettier":"^2.8.7","reflect-metadata":"^0.1.13","rimraf":"^4.4.1","standard-version":"^9.5.0","ts-jest":"^29.0.5","ts-node":"^10.9.1","typescript":"^5.0.2"},"jest":{"moduleDirectories":["node_modules","src"],"moduleFileExtensions":["js","json","ts"],"roots":["src"],"testRegex":".*\\.spec\\.ts$","transform":{"^.+\\.(t|j)s$":"ts-jest"},"collectCoverageFrom":["**/*.(t|j)s"],"coverageDirectory":"../coverage","testEnvironment":"node","moduleNameMapper":{"src/(.*)":"<rootDir>/src/$1"}},"types":"./dist/index.d.ts","homepage":"https://github.com/atmus-tecnologia/nestjs-storage#readme","_id":"@atmus/nestjs-storage@1.0.2","gitHead":"0efc3e0318219e81dd7fb291afbab805238a4161","_nodeVersion":"20.18.0","_npmVersion":"10.9.0","dist":{"integrity":"sha512-pxGr2hOy6dMlY+OSJCwnYBT1rzFtcr5QJgU+v1aPY5vwnF5MFiaW27LHQqVSmDLstazoWojtEj3bItxOQWb4Rw==","shasum":"f5302fe88c0d19501e5fe0de1c8fbc45ecd49890","tarball":"https://registry.npmjs.org/@atmus/nestjs-storage/-/nestjs-storage-1.0.2.tgz","fileCount":23,"unpackedSize":38700,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGOQ+wV6vvN0uFqwqYI7sbcZIEN472+4L2tofCKQbK7sAiAOvNByPuUHKkTHLHObwQfSncSfXZPGYho7PNGXMMoTmQ=="}]},"_npmUser":{"name":"fmedeiros","email":"medeiros.dev@gmail.com"},"directories":{},"maintainers":[{"name":"fmedeiros","email":"medeiros.dev@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/nestjs-storage_1.0.2_1731001539967_0.7817862016740664"},"_hasShrinkwrap":false}},"time":{"created":"2024-06-29T15:52:43.982Z","modified":"2024-11-07T17:45:40.385Z","1.0.0":"2024-06-29T15:52:44.292Z","1.0.1":"2024-06-29T16:21:17.691Z","1.0.2":"2024-11-07T17:45:40.180Z"},"bugs":{"url":"https://github.com/atmus-tecnologia/nestjs-storage/issues"},"author":{"name":"Atmus Tecnologia","email":"contato@atmustecnologia.com.br"},"license":"MIT","homepage":"https://github.com/atmus-tecnologia/nestjs-storage#readme","keywords":["nestjs","storage","aws-s3","google-cloud-storage","azure-blob","local-storage"],"repository":{"type":"git","url":"git+https://github.com/atmus-tecnologia/nestjs-storage.git"},"description":"NestJS storage library supporting AWS S3, Google Cloud Storage, Azure Blob, and local storage.","maintainers":[{"name":"fmedeiros","email":"medeiros.dev@gmail.com"}],"readme":"# NestJS Storage\r\n\r\nNestJS Storage é um módulo NestJS que fornece uma interface unificada para manipular operações de armazenamento de arquivos em vários provedores, incluindo AWS S3, Google Cloud Storage, Azure Blob Storage e armazenamento local.\r\n\r\n## Features\r\n\r\n- Upload de arquivos para AWS S3, Google Cloud Storage, Azure Blob Storage ou sistema de arquivos local.\r\n- Download de arquivos desses provedores de armazenamento.\r\n- Exclusão de arquivos desses provedores de armazenamento.\r\n- Visualização de arquivos diretamente no navegador.\r\n\r\n## Instalação\r\n\r\nInstale a biblioteca e suas dependências:\r\n\r\n```bash\r\nnpm install @atmus/nestjs-storage\r\n```\r\n\r\n## Configuração\r\n\r\nConfigure as definições do provedor de armazenamento usando variáveis de ambiente. Aqui está um exemplo de arquivo `.env`:\r\n\r\n```env\r\nSTORAGE_PROVIDER=local\r\n\r\nAWS_ACCESS_KEY_ID=your_aws_access_key_id\r\nAWS_SECRET_ACCESS_KEY=your_aws_secret_access_key\r\nAWS_REGION=your_aws_region\r\nAWS_BUCKET=your_aws_bucket\r\n\r\nGCP_PROJECT_ID=your_gcp_project_id\r\nGCP_KEY_FILENAME=path_to_your_gcp_keyfile.json\r\nGCP_BUCKET=your_gcp_bucket\r\n\r\nAZURE_CONNECTION_STRING=your_azure_connection_string\r\nAZURE_CONTAINER_NAME=your_azure_container_name\r\n\r\nLOCAL_STORAGE_DIRECTORY=./uploads\r\n```\r\n\r\n## Uso\r\n\r\n### Importando o Módulo\r\n\r\nImporte o `StorageModule` no módulo raiz da sua aplicação NestJS:\r\n\r\n```typescript\r\nimport { Module } from '@nestjs/common';\r\nimport { ConfigModule } from '@nestjs/config';\r\nimport { StorageModule } from '@atmus/nestjs-storage';\r\n\r\n@Module({\r\n  imports: [\r\n    ConfigModule.forRoot({\r\n      isGlobal: true,\r\n    }),\r\n    StorageModule,\r\n  ],\r\n})\r\nexport class AppModule {}\r\n```\r\n\r\n### Usando o Storage Service\r\n\r\nUse o `StorageService` em seus controladores ou serviços para manipular operações de arquivos:\r\n\r\n```typescript\r\nimport { Controller, Post, Get, Delete, Param, UploadedFile, UseInterceptors, Res } from '@nestjs/common';\r\nimport { FileInterceptor } from '@nestjs/platform-express';\r\nimport { StorageService } from '@atmus/nestjs-storage';\r\nimport { Response } from 'express';\r\n\r\n@Controller('files')\r\nexport class AppController {\r\n  constructor(private readonly storageService: StorageService) {}\r\n\r\n  @Post()\r\n  @UseInterceptors(FileInterceptor('file'))\r\n  async uploadFile(@UploadedFile() file: Express.Multer.File) {\r\n    const filePath = await this.storageService.uploadFile(file);\r\n    return { filePath };\r\n  }\r\n\r\n  @Get(':fileName/download')\r\n  async downloadFile(@Param('fileName') fileName: string, @Res() res: Response) {\r\n    const fileBuffer = await this.storageService.downloadFile(fileName);\r\n    res.set({\r\n      'Content-Type': 'application/octet-stream',\r\n      'Content-Disposition': `attachment; filename=\"${fileName}\"`,\r\n    });\r\n    res.send(fileBuffer);\r\n  }\r\n\r\n  @Get(':fileName')\r\n  async viewFile(@Param('fileName') fileName: string, @Res() res: Response) {\r\n    const fileBuffer = await this.storageService.downloadFile(fileName);\r\n    const mimeType = mime.lookup(fileName) || 'application/octet-stream';\r\n    res.set({\r\n      'Content-Type': mimeType,\r\n      'Content-Disposition': `inline; filename=\"${fileName}\"`,\r\n    });\r\n    res.send(fileBuffer);\r\n  }\r\n\r\n  @Delete(':fileName')\r\n  async deleteFile(@Param('fileName') fileName: string) {\r\n    await this.storageService.deleteFile(fileName);\r\n    return { message: 'File deleted successfully' };\r\n  }\r\n}\r\n```\r\n\r\n## Provedores de Armazenamento\r\n\r\n### AWS S3\r\n\r\nCertifique-se de ter as seguintes variáveis de ambiente configuradas:\r\n\r\n```env\r\nSTORAGE_PROVIDER=aws\r\nAWS_ACCESS_KEY_ID=your_aws_access_key_id\r\nAWS_SECRET_ACCESS_KEY=your_aws_secret_access_key\r\nAWS_REGION=your_aws_region\r\nAWS_BUCKET=your_aws_bucket\r\n```\r\n\r\n### Google Cloud Storage\r\n\r\nCertifique-se de ter as seguintes variáveis de ambiente configuradas:\r\n\r\n```env\r\nSTORAGE_PROVIDER=gcp\r\nGCP_PROJECT_ID=your_gcp_project_id\r\nGCP_KEY_FILENAME=path_to_your_gcp_keyfile.json\r\nGCP_BUCKET=your_gcp_bucket\r\n```\r\n\r\n### Azure Blob Storage\r\n\r\nCertifique-se de ter as seguintes variáveis de ambiente configuradas:\r\n\r\n```env\r\nSTORAGE_PROVIDER=azure\r\nAZURE_CONNECTION_STRING=your_azure_connection_string\r\nAZURE_CONTAINER_NAME=your_azure_container_name\r\n```\r\n\r\n### Sistema de Arquivos Local\r\n\r\nCertifique-se de ter as seguintes variáveis de ambiente configuradas:\r\n\r\n```env\r\nSTORAGE_PROVIDER=local\r\nLOCAL_STORAGE_DIRECTORY=./uploads\r\n```\r\n\r\n## Licença\r\n\r\nEste projeto está licenciado sob a licença MIT. Veja o arquivo [LICENSE](LICENSE) para mais detalhes.\r\n\r\n## Contribuição\r\n\r\nContribuições são bem-vindas! Por favor, abra uma issue ou envie um pull request para quaisquer alterações.\r\n\r\n## Autor\r\n\r\nAtmus Tecnologia - [atmustecnologia.com.br](https://atmustecnologia.com.br).","readmeFilename":"README.md"}