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

cap-angular-schematic-storage-aws

v1.0.12

Published

Schematics to upload images using AWS S3.

Downloads

3

Readme

CAP STORAGE AWS Schematic Generic badge

CAP STORAGE AWS Schematic is a schematic for Angular, this schematic allows you to upload images using AWS S3.

Previous requirements

CAP STORAGE AWS use bootstrap's classes. To be able to display the component in the right way, bootstrap should have been installed in the project. In case you don't have bootstrap installed, you can run the following command or read their documentation:

npm install bootstrap

One's that you installed bootstrap you have to configure the angular.json and write into styles

"styles": [
  "node_modules/bootstrap/dist/css/bootstrap.min.css",
  "styles.scss"
]

Note!

The schematics modify the polifylls.ts adding:

(window as any).global = window;

This allows the npm packages to fix some issues related to the global variable.

If you have some problems with the npm dependency you can also resolve these issues, either add "types": ["node"] to the project's tsconfig.app.json file, or remove the "types" field entirely.

Installation

Write the following command:

ng add cap-angular-schematic-storage-aws

AWS S3 Configuration

We recommend creating a specific folder into your bucket to save your images. Into your bucket go to permissions' sections, after that, go to CORS configuration and write the following code:

<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<CORSRule>
    <AllowedOrigin>*</AllowedOrigin>
    <AllowedMethod>HEAD</AllowedMethod>
    <AllowedMethod>GET</AllowedMethod>
    <AllowedMethod>POST</AllowedMethod>
    <ExposeHeader>ETag</ExposeHeader>
    <ExposeHeader>x-amz-meta-custom-header</ExposeHeader>
    <AllowedHeader>*</AllowedHeader>
</CORSRule>
</CORSConfiguration>

HTML tags

Cap Upload

Tag to upload images into an Amazon bucket.

Example of implementation

<cap-upload></cap-upload>

Alt text

Cap Upload Drag and Drop

This tag use an external dependency called ngx-file-drop. Tag to upload any kind of file Example of implementation

<cap-upload-drag-drop></cap-upload-drag-drop>

Alt text

Services

The schematic contains a storage service, this services expose a method to upload images and get the images of the bucket.

Method getFiles (example to get images)

import { StorageService } from 'cap-storage-aws/src/services/storage.service';

constructor( private _fileUpload: StorageService ) {
        this.showFiles()
    }
    ngOnInit() {}

    getFiles(){
        this.images = this._fileUpload.getFiles();
    }

Method upload

The upload method receives 2 parameters: A file(image) to upload and a callback, this callback it's for the event On for know when the image upload it's complete.

upload(file:any, fn:any){

}