npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

angular-aws-s3

v1.0.0

Published

Open Source Module to Upload your Media and files into AWS S3 Bucket directly from Front-end

Downloads

6

Readme

angular-aws-s3

Open Source Module to Upload your Media and files into AWS S3 Bucket directly from Front-end. AWSS3 - A Javascript Library for AWS S3 File Upload

This project is a fork of aws-s3-upload-ash

I thank the original authors for their work on this project.

Changes

  • Update cryptojs dependency version to a version without vulnerabilities.

NPM

https://www.npmjs.com/package/angular-aws-s3

How to use(youtube)

  • How to use with React/Next.js = https://youtu.be/kMsIUTNVlaU
  • How to use with Angular(12) = https://youtu.be/LV1U_1G0vYs
  • How to use with Vue = https://youtu.be/9x5LGaL2W7E

How to get

Using NPM

npm install angular-aws-s3

Using Yarn

yarn add angular-aws-s3

Examples Uploading a file

React using Next.js

  • https://github.com/ismaelash/aws-s3-upload-nextjs

Angular 12

  • https://github.com/ismaelash/aws-s3-upload-angular12

Vue

  • https://github.com/ismaelash/aws-s3-upload-vue

Deleting an existing file into directory in your bucket public

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

import AWSS3UploadClient from 'angular-aws-s3';


const config = {
    bucketName: 'bucketName',
    dirName: 'media',
    region: 'us-east-1',
    accessKeyId: process.env.accessKeyId,
    secretAccessKey: process.env.secretAccessKey,
    s3Url: 'https://bucketName.s3.amazonaws.com/'
}

const S3CustomClient = new AWSS3UploadClient(config);

const newFileNameWithExtesion = 'fileName.extesion';

S3CustomClient
    .deleteFile(newFileNameWithExtesion)
    .then(response => console.log(response))
    .catch(err => console.error(err))

  /**
   * {
   *   Response: {
   *      ok: true,
   *      status: 204,
   *      message: 'File deleted',
   *      fileName: 'media/fileName.extesion';
   *   }
   * }
   */
});

Deleting an existing file without directory in your bucket public

import AWSS3UploadClient from 'angular-aws-s3';


const config = {
    bucketName: 'bucketName',
    region: 'us-east-1',
    accessKeyId: process.env.accessKeyId,
    secretAccessKey: process.env.secretAccessKey,
    s3Url: 'https://bucketName.s3.amazonaws.com/'
}

const S3CustomClient = new AWSS3UploadClient(config);

const newFileNameWithExtesion = 'fileName.extesion';

S3CustomClient
    .deleteFile(newFileNameWithExtesion)
    .then(response => console.log(response))
    .catch(err => console.error(err))

  /**
   * {
   *   Response: {
   *      ok: true,
   *      status: 204,
   *      message: 'File deleted',
   *      fileName: 'fileName.extesion';
   *   }
   * }
   */
});

Important

  1. If you bucket is public use only this parameters: file, contentType, newFileNameWithExtesion see the example above
  2. If you bucket is private(with Objects can be public) use presignedURL parameter (recommended)

AWS S3 Links

  • S3 Bucket Policies: https://docs.aws.amazon.com/AmazonS3/latest/dev/example-bucket-policies.html
  • ACL: https://docs.aws.amazon.com/AmazonS3/latest/userguide/acl-overview.html
  • Presigned URL: https://docs.aws.amazon.com/AmazonS3/latest/userguide/ShareObjectPreSignedURL.html
  • Upload Presigned URL: https://docs.aws.amazon.com/AmazonS3/latest/userguide/PresignedUrlUploadObject.html
  • Input html: https://www.w3schools.com/tags/tag_input.asp
  • S3 Bucket Cors: https://docs.aws.amazon.com/AmazonS3/latest/userguide/ManageCorsUsing.html

License

MIT