All Projects → Fausto95 → Aws S3

Fausto95 / Aws S3

Licence: mit
S3Client - A Javascript Library for AWS S3 File Upload

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Aws S3

ionic-image-upload
Ionic Plugin for Uploading Images to Amazon S3
Stars: ✭ 26 (-67.09%)
Mutual labels:  s3-bucket, javascript-library
Ac D3
Javascript Library for building Audiovisual Charts in D3
Stars: ✭ 76 (-3.8%)
Mutual labels:  javascript-library
Fobo
FoBo - A Modular Front-End Toolkit module for Lift
Stars: ✭ 59 (-25.32%)
Mutual labels:  javascript-library
Egeo
EGEO is the open-source UI library used to build Stratio's UI. It includes UI Components, Utilities, Services and much more to build user interfaces quickly and with ease. The library is distributed in AoT mode.
Stars: ✭ 69 (-12.66%)
Mutual labels:  javascript-library
Aws Cli Docker
Docker container with the AWS CLI
Stars: ✭ 62 (-21.52%)
Mutual labels:  s3-bucket
Bin
A tiny (<1kb) localStorage and sessionStorage helper library.
Stars: ✭ 70 (-11.39%)
Mutual labels:  javascript-library
Evangelist
🌟 Library of helpers that are useful for functional programming
Stars: ✭ 58 (-26.58%)
Mutual labels:  javascript-library
Iroha Javascript
JavaScript library for Iroha, a Distributed Ledger Technology (blockchain) platform.
Stars: ✭ 77 (-2.53%)
Mutual labels:  javascript-library
Ibantools
IBANTools is TypeScript/JavaScript library for validation, creation and extraction of IBAN, BBAN and BIC/SWIFT numbers.
Stars: ✭ 73 (-7.59%)
Mutual labels:  javascript-library
Web Audio Javascript Webassembly Sdk Interactive Audio
🌐 Superpowered Web Audio JavaScript and WebAssembly SDK for modern web browsers. Allows developers to implement low-latency interactive audio features into web sites and web apps with a friendly Javascript API. https://superpowered.com
Stars: ✭ 68 (-13.92%)
Mutual labels:  javascript-library
Plantuml Parser
Parse PlantUML with JavaScript or TypeScript
Stars: ✭ 67 (-15.19%)
Mutual labels:  javascript-library
Share Selected Text
share selected text on twitter, buffer, and some others. Inspired by medium.com
Stars: ✭ 64 (-18.99%)
Mutual labels:  javascript-library
Spotifycurrentlyplaying.js
Display your currently playing Spotify song(s) using Last.fm scrobbling.
Stars: ✭ 71 (-10.13%)
Mutual labels:  javascript-library
Particleeffectsbuttons
A little library that can be used for bursting particles effects on buttons and other elements
Stars: ✭ 1,122 (+1320.25%)
Mutual labels:  javascript-library
Tag Handler
Tag Handler is a jQuery plugin used for managing tag-type metadata.
Stars: ✭ 76 (-3.8%)
Mutual labels:  javascript-library
Fine Uploader
Multiple file upload plugin with image previews, drag and drop, progress bars. S3 and Azure support, image scaling, form support, chunking, resume, pause, and tons of other features.
Stars: ✭ 8,158 (+10226.58%)
Mutual labels:  javascript-library
Push.js
The world's most versatile desktop notifications framework 🌎
Stars: ✭ 8,536 (+10705.06%)
Mutual labels:  javascript-library
Aws Lambda Swift Sprinter
AWS Lambda Custom Runtime for Swift with swift-nio 2.0 support
Stars: ✭ 70 (-11.39%)
Mutual labels:  s3-bucket
Ditherjs
A javascript library which dithers an <img> using a fixed palette
Stars: ✭ 76 (-3.8%)
Mutual labels:  javascript-library
Easygrid
EasyGrid - VanillaJS Responsive Grid
Stars: ✭ 77 (-2.53%)
Mutual labels:  javascript-library

S3Client AWS-S3

S3Client - A Javascript Library for AWS S3 File Upload

npm install --save aws-s3

Examples Uploading An Image

Uploading to S3

import S3 from 'aws-s3';

const config = {
    bucketName: 'myBucket',
    dirName: 'photos', /* optional */
    region: 'eu-west-1',
    accessKeyId: 'ANEIFNENI4324N2NIEXAMPLE',
    secretAccessKey: 'cms21uMxçduyUxYjeg20+DEkgDxe6veFosBT7eUgEXAMPLE',
    s3Url: 'https://my-s3-url.com/', /* optional */
}

const S3Client = new S3(config);
/*  Notice that if you don't provide a dirName, the file will be automatically uploaded to the root of your bucket */

/* This is optional */
const newFileName = 'my-awesome-file';

S3Client
    .uploadFile(file, newFileName)
    .then(data => console.log(data))
    .catch(err => console.error(err))

  /**
   * {
   *   Response: {
   *     bucket: "your-bucket-name",
   *     key: "photos/image.jpg",
   *     location: "https://your-bucket.s3.amazonaws.com/photos/image.jpg"
   *   }
   * }
   */
});

Deleting an existing file in your bucket

In this case the file that we want to delete is in the folder 'photos'

import S3 from 'aws-s3';


const config = {
    bucketName: 'myBucket',
    dirName: 'school-documents',
    region: 'eu-west-1',
    accessKeyId: 'ANEIFNENI4324N2NIEXAMPLE',
    secretAccessKey: 'cms21uMxçduyUxYjeg20+DEkgDxe6veFosBT7eUgEXAMPLE',
    s3Url: 'https://my-s3-url.com/', /* optional */
}

const S3Client = new S3(config);

const filename = 'hello-world.pdf';

/* 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 */

//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

S3Client
    .deleteFile(filename)
    .then(response => console.log(response))
    .catch(err => console.error(err))

  /**
   * {
   *   Response: {
   *      ok: true,
          status: 204,
          message: 'File deleted',
          fileName: 'hello-world.pdf'
   *   }
   * }
   */
});

S3 Bucket Policy

Doc: http://docs.aws.amazon.com/AmazonS3/latest/dev/example-bucket-policies.html

{
    "Version": "2012-10-17",
    "Id": "http referer policy example",
    "Statement": [
        {
            "Sid": "Allow all kind of http requests originating from http://www.your-website.com and https://www.your-website.com",
            "Effect": "Allow",
            "Principal": "*",
            "Action": [
                "s3:PutObject",
                "s3:PutObjectAcl",
                "s3:GetObject",
                "s3:GetObjectAcl",
                "s3:DeleteObject"
            ],
            "Resource": "arn:aws:s3:::myBucket/*",
            "Condition": {
                "StringLike": {
                    "aws:Referer": [
                        "https://www.your-website.com",
                        "http://www.your-website.com"
                    ]
                }
            }
        }
    ]
}

Defaults your bucket to public-read : http://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html

config

  • bucketName required - Your S3 bucket
  • dirName required - Your S3 folderName/dirName
  • region required - Your S3 bucket's region
  • accessKeyId required - Your S3 AccessKeyId
  • secretAccessKey required - Your S3 SecretAccessKey
  • s3Url optional - Your S3 URL

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].