{"id":15684825,"url":"https://github.com/sholladay/hapi-s3","last_synced_at":"2025-05-07T16:11:57.799Z","repository":{"id":57261159,"uuid":"109787804","full_name":"sholladay/hapi-s3","owner":"sholladay","description":"Use Amazon S3 in your hapi server","archived":false,"fork":false,"pushed_at":"2020-01-13T18:51:44.000Z","size":21,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-27T04:01:51.894Z","etag":null,"topics":["aws","hapi","plugin","s3","server","storage"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sholladay.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-11-07T04:43:26.000Z","updated_at":"2021-10-23T20:13:14.000Z","dependencies_parsed_at":"2022-09-13T03:31:37.013Z","dependency_job_id":null,"html_url":"https://github.com/sholladay/hapi-s3","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sholladay%2Fhapi-s3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sholladay%2Fhapi-s3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sholladay%2Fhapi-s3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sholladay%2Fhapi-s3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sholladay","download_url":"https://codeload.github.com/sholladay/hapi-s3/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252631983,"owners_count":21779548,"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","hapi","plugin","s3","server","storage"],"created_at":"2024-10-03T17:21:54.181Z","updated_at":"2025-05-07T16:11:57.779Z","avatar_url":"https://github.com/sholladay.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hapi-s3 [![Build status for hapi S3](https://travis-ci.com/sholladay/hapi-s3.svg?branch=master \"Build Status\")](https://travis-ci.com/sholladay/hapi-s3 \"Builds\")\n\n\u003e Use [Amazon S3](https://aws.amazon.com/s3/) in your [hapi](https://hapijs.com/) server\n\nProvides an instance of [Scube](https://github.com/sholladay/scube), a thin wrapper around the S3 client from the [AWS SDK](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/index.html), so you can interact with S3 programmatically. It is available at `request.server.s3` in route handlers.\n\n## Why?\n\n - Easily implement streaming uploads / downloads.\n - Memory efficient, with one instance of the [AWS SDK](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/index.html) per server.\n - Loads credentials explicitly.\n\n## Install\n\n```sh\nnpm install hapi-s3\n```\n\n## Usage\n\nRegister the plugin on your server to make `request.server.s3` available in route handlers.\n\n```js\nconst hapi = require('@hapi/hapi');\nconst s3 = require('hapi-s3');\n\nconst server = hapi.server();\n\nconst init = async () =\u003e {\n    await server.register({\n        plugin  : s3,\n        options : {\n            bucket    : 'my-bucket',\n            publicKey : process.env.AWS_ACCESS_KEY_ID,\n            secretKey : process.env.AWS_SECRET_ACCESS_KEY\n        }\n    });\n    server.route({\n        method : 'GET',\n        path   : '/',\n        async handler(request) {\n            const { s3 } = request.server;\n            const buckets = await s3.listBuckets();\n            return buckets;\n        }\n    });\n    await server.start();\n    console.log('Server ready:', server.info.uri);\n};\n\ninit();\n```\n\n## API\n\nPlease see [Scube](https://github.com/sholladay/scube) for details on the `s3` object.\n\n### Plugin options\n\nType: `object`\n\nThe options are passed to `new Scube()` to configure the S3 client. See [Scube](https://github.com/sholladay/scube) for details on the available options, such as `bucket`, `region`, and others.\n\n### Decorations\n\nFor convenience, this plugin adds the following API to the hapi server instance.\n\n#### server.s3\n\nAn instance of [Scube](https://github.com/sholladay/scube), a thin wrapper around the S3 client from the [AWS SDK](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/index.html). This is available as `request.server.s3` inside of route handlers.\n\n## Related\n\n - [scube](https://github.com/sholladay/scube) - Manage your [S3](https://aws.amazon.com/s3/) buckets\n\n## Contributing\n\nSee our [contributing guidelines](https://github.com/sholladay/hapi-s3/blob/master/CONTRIBUTING.md \"Guidelines for participating in this project\") for more details.\n\n1. [Fork it](https://github.com/sholladay/hapi-s3/fork).\n2. Make a feature branch: `git checkout -b my-new-feature`\n3. Commit your changes: `git commit -am 'Add some feature'`\n4. Push to the branch: `git push origin my-new-feature`\n5. [Submit a pull request](https://github.com/sholladay/hapi-s3/compare \"Submit code to this project for review\").\n\n## License\n\n[MPL-2.0](https://github.com/sholladay/hapi-s3/blob/master/LICENSE \"License for hapi-s3\") © [Seth Holladay](https://seth-holladay.com \"Author of hapi-s3\")\n\nGo make something, dang it.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsholladay%2Fhapi-s3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsholladay%2Fhapi-s3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsholladay%2Fhapi-s3/lists"}