{"id":13709273,"url":"https://github.com/Fausto95/aws-s3","last_synced_at":"2025-05-06T15:32:29.170Z","repository":{"id":26214894,"uuid":"107321085","full_name":"Fausto95/aws-s3","owner":"Fausto95","description":"S3Client - A Javascript Library for AWS S3 File Upload","archived":true,"fork":false,"pushed_at":"2022-04-06T08:36:53.000Z","size":289,"stargazers_count":113,"open_issues_count":47,"forks_count":67,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-28T15:49:23.058Z","etag":null,"topics":["javascript-library","s3-bucket","s3client"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/aws-s3","language":"TypeScript","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/Fausto95.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-10-17T20:37:24.000Z","updated_at":"2025-03-28T11:56:09.000Z","dependencies_parsed_at":"2022-08-19T13:20:39.109Z","dependency_job_id":null,"html_url":"https://github.com/Fausto95/aws-s3","commit_stats":null,"previous_names":["fausto95/react-s3"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fausto95%2Faws-s3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fausto95%2Faws-s3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fausto95%2Faws-s3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Fausto95%2Faws-s3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Fausto95","download_url":"https://codeload.github.com/Fausto95/aws-s3/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252713025,"owners_count":21792414,"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":["javascript-library","s3-bucket","s3client"],"created_at":"2024-08-02T23:00:37.467Z","updated_at":"2025-05-06T15:32:26.146Z","avatar_url":"https://github.com/Fausto95.png","language":"TypeScript","funding_links":[],"categories":["Uncategorized"],"sub_categories":["Uncategorized"],"readme":"🚨🚨🚨 STALE 🚨🚨🚨\n\n\u003e While this library might still work, I'm no longer maintaining it. Feel free to fork and patch if needed.\n\n# S3Client AWS-S3\n\nS3Client - A Javascript Library for AWS S3 File Upload\n\n```\nnpm install --save aws-s3\n```\n\n\n# Examples Uploading An Image\n\n## ***Uploading to S3***\n\n```js\nimport S3 from 'aws-s3';\n\nconst config = {\n    bucketName: 'myBucket',\n    dirName: 'photos', /* optional */\n    region: 'eu-west-1',\n    accessKeyId: 'ANEIFNENI4324N2NIEXAMPLE',\n    secretAccessKey: 'cms21uMxçduyUxYjeg20+DEkgDxe6veFosBT7eUgEXAMPLE',\n    s3Url: 'https://my-s3-url.com/', /* optional */\n}\n\nconst S3Client = new S3(config);\n/*  Notice that if you don't provide a dirName, the file will be automatically uploaded to the root of your bucket */\n\n/* This is optional */\nconst newFileName = 'my-awesome-file';\n\nS3Client\n    .uploadFile(file, newFileName)\n    .then(data =\u003e console.log(data))\n    .catch(err =\u003e console.error(err))\n\n  /**\n   * {\n   *   Response: {\n   *     bucket: \"your-bucket-name\",\n   *     key: \"photos/image.jpg\",\n   *     location: \"https://your-bucket.s3.amazonaws.com/photos/image.jpg\"\n   *   }\n   * }\n   */\n});\n```\n\n## ***Deleting an existing file in your bucket***\n\nIn this case the file that we want to delete is in the folder 'photos'\n\n```js\nimport S3 from 'aws-s3';\n\n\nconst config = {\n    bucketName: 'myBucket',\n    dirName: 'school-documents',\n    region: 'eu-west-1',\n    accessKeyId: 'ANEIFNENI4324N2NIEXAMPLE',\n    secretAccessKey: 'cms21uMxçduyUxYjeg20+DEkgDxe6veFosBT7eUgEXAMPLE',\n    s3Url: 'https://my-s3-url.com/', /* optional */\n}\n\nconst S3Client = new S3(config);\n\nconst filename = 'hello-world.pdf';\n\n/* If the file that you want to delete it's in your bucket's root folder, don't provide any dirName in the config object */\n\n//In this case the file that we want to delete is in the folder 'photos' that we referred in the config object as the dirName\n\nS3Client\n    .deleteFile(filename)\n    .then(response =\u003e console.log(response))\n    .catch(err =\u003e console.error(err))\n\n  /**\n   * {\n   *   Response: {\n   *      ok: true,\n          status: 204,\n          message: 'File deleted',\n          fileName: 'hello-world.pdf'\n   *   }\n   * }\n   */\n});\n```\n\n## ***S3 Bucket Policy***\n\nDoc: http://docs.aws.amazon.com/AmazonS3/latest/dev/example-bucket-policies.html\n\n```json\n{\n    \"Version\": \"2012-10-17\",\n    \"Id\": \"http referer policy example\",\n    \"Statement\": [\n        {\n            \"Sid\": \"Allow all kind of http requests originating from http://www.your-website.com and https://www.your-website.com\",\n            \"Effect\": \"Allow\",\n            \"Principal\": \"*\",\n            \"Action\": [\n                \"s3:PutObject\",\n                \"s3:PutObjectAcl\",\n                \"s3:GetObject\",\n                \"s3:GetObjectAcl\",\n                \"s3:DeleteObject\"\n            ],\n            \"Resource\": \"arn:aws:s3:::myBucket/*\",\n            \"Condition\": {\n                \"StringLike\": {\n                    \"aws:Referer\": [\n                        \"https://www.your-website.com\",\n                        \"http://www.your-website.com\"\n                    ]\n                }\n            }\n        }\n    ]\n}\n```\n\nDefaults your bucket to `public-read` : http://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html\n\n`config`\n  * `bucketName` **required** - Your S3 bucket\n  * `dirName` **required** - Your S3 folderName/dirName\n  * `region` **required** - Your S3 bucket's region\n  * `accessKeyId` **required** - Your S3 `AccessKeyId`\n  * `secretAccessKey` **required** - Your S3 `SecretAccessKey`\n  * `s3Url` **optional** - Your S3 URL\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFausto95%2Faws-s3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FFausto95%2Faws-s3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFausto95%2Faws-s3/lists"}