{"id":19788443,"url":"https://github.com/ashiknesin/s3-bucket","last_synced_at":"2025-06-23T16:04:56.682Z","repository":{"id":89106433,"uuid":"94070969","full_name":"AshikNesin/s3-bucket","owner":"AshikNesin","description":"Simple AWS S3 Wrapper 🔥","archived":false,"fork":false,"pushed_at":"2018-05-22T07:47:02.000Z","size":85,"stargazers_count":10,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-01T00:37:19.682Z","etag":null,"topics":["aws","aws-s3","aws-sdk","file-upload","nodejs","s3","s3-bucket"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/s3-bucket","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AshikNesin.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license","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":"2017-06-12T08:05:07.000Z","updated_at":"2021-01-08T05:31:39.000Z","dependencies_parsed_at":"2023-06-10T04:15:47.073Z","dependency_job_id":null,"html_url":"https://github.com/AshikNesin/s3-bucket","commit_stats":{"total_commits":11,"total_committers":1,"mean_commits":11.0,"dds":0.0,"last_synced_commit":"587e8cfcc9929709d7eeb375007d5532538389a0"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/AshikNesin/s3-bucket","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AshikNesin%2Fs3-bucket","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AshikNesin%2Fs3-bucket/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AshikNesin%2Fs3-bucket/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AshikNesin%2Fs3-bucket/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AshikNesin","download_url":"https://codeload.github.com/AshikNesin/s3-bucket/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AshikNesin%2Fs3-bucket/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261509607,"owners_count":23169676,"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","aws-s3","aws-sdk","file-upload","nodejs","s3","s3-bucket"],"created_at":"2024-11-12T06:27:24.689Z","updated_at":"2025-06-23T16:04:56.632Z","avatar_url":"https://github.com/AshikNesin.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003e Simple AWS S3 Wrapper 🔥\n\n## Install\n\n```\n$ npm install s3-bucket\n```\n\n\n## Environment Variables\n\n```\nS3_BUCKET_ACCESS_KEY_ID=value\nS3_BUCKET_SECRET_ACCESS_KEY=value\n\nS3_BUCKET_NAME=value\nS3_BUCKET_REGION=value\n\n```\n\n## Usage\n\n```js\n// Don't forgot to import the function 😊\nconst {\n\tupdateCredentials,\n\tupdateRegion,\n\tgetAllBuckets,\n\tgetUploadUrl,\n\tuploadFile,\n\tlistFiles,\n\tdeleteFiles,\n} = require('s3-bucket');\n\n```\n\n### getAllBuckets()\n\nYep! Like you've already guessed. It'll list all the buckets in your AWS account.\n\n```js\n// Request\ngetAllBuckets()\n\t.then(buckets =\u003e console.log(buckets));\n// Response\n{\n\tBuckets:\n\t[\n\t\t { Name: 'your-bucket-name', CreationDate: '2017-09-14T13:14:01.000Z' },\n\t],\n  Owner:{ ID: 'your-id-here' }\n}\n\n```\n---\n\n### getUploadUrl(customParams)\nGet Signed Upload URL. Then use that to upload files to upload files directly to S3 without sending it to your server.\n\n#### Required Params\nContentType → content type of the file.\nKey → path of that file within your S3 bucket\n\n#### Optional Params\nBucket\nACL → public-read by default\nExpires → 60 seconds\n\n```js\n// Request\ngetUploadUrl({\n\tContentType: 'application/javascript',\n\tKey: 'your-dir/test.js'\n}).then(res =\u003e console.log(res))\n\n// Response\n{ signedUrl: 'https://s3.ap-south-1.amazonaws.com/your-bucket-name/your-dir/test.js?all-query-strings' }\n\n```\n\n---\n\n\n### uploadFile(customParams)\nUpload files to your S3 bucket.\n\n#### Required Params\nfilePath → absolute path to the file\nKey → path of that file within your S3 bucket\n\n#### Optional Params\nBucket\nACL → public-read by default\nExpires → 60 seconds\n\n```js\n// Request\nuploadFile({\n\tfilePath: 'path/to/your/file.js',\n\tKey: 'your-dir/test.js'})\n.then(res =\u003e console.log(res));\n\n// Response\n{ ETag: '\"9184ea01719a9444c823f1cb797529c9\"',\n\turl: 'https://your-bucket-name.s3.amazonaws.com/your-dir/test.js'\n}\n\n```\n\n---\n\n\n### listFiles(customParams)\nJust list all the files(objects) in your bucket.\n\n#### Optional Params\nBucket\n\n```js\n// Request\nlistFiles({}).then(files =\u003e console.log(files))\n\n// Response\n{ IsTruncated: false,\n  Contents:\n   [ { Key: 'your-dir/test.js',\n       LastModified: '2017-12-18T09:58:09.000Z',\n       ETag: '\"fd131f0975cdb3b6422290261866bf01\"',\n       Size: 383,\n       StorageClass: 'STANDARD' },\n\t],\n  Name: 'your-bucket-name',\n  Prefix: '',\n  MaxKeys: 1000,\n  CommonPrefixes: [],\n  KeyCount: 31 }\n```\n\n---\n\n\n### deleteFiles(customParams)\nLet's delete files 🗑️\n\n#### Required Params\nfiles → path to files (Keys) in array\n\n#### Optional Params\nBucket\n\n\n```js\n// Request\ndeleteFiles({\n\tfiles: ['your-dir/test.js']\n})\n.then(res =\u003e console.log(res));\n\n// Response\n{ Deleted: [ { Key: '/your-dir/test.js' } ], Errors: [] }\n\n```\n\n---\n\n\n### updateCredentials(credentials)\n\nSometimes we want to set our AWS credentials dynamically.\n\nIn that senario we can use updateCredentials() to set the **credentials on the fly**\n\n```js\n\tconst credentials = {\n\t\taccessKeyId:'your-aws-access-key',\n\t\tsecretAccessKey:'your-aws-secret-key'\n\t};\n\tupdateCredentials(credentials)\n```\n\n---\n\n\n### updateRegion(region)\n\nSetting our S3 region on the fly\n\n```js\n\tupdateRegion('ap-south-1')\n```\n\n---\n\n### updateBucketName(bucketName)\n\nSetting our S3 region on the fly\n\n```js\n\tupdateBucketName('new-bucket-name')\n```\n\n## TODO\n- Handle Missing credentials errors\n- File Upload Progress\n\n## License\n\nMIT © [Ashik Nesin](https://ashiknesin.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fashiknesin%2Fs3-bucket","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fashiknesin%2Fs3-bucket","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fashiknesin%2Fs3-bucket/lists"}