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

@caliatys/s3-service

v1.1.1

Published

Typescript service for AWS S3 with Angular

Downloads

30

Readme

Manage your S3 buckets with AWS

This Angular Library, which currently supports Angular 6.x and 7.x, is a wrapper around the aws-sdk libraries to easily manage your S3 buckets.

Demo

git clone https://github.com/Caliatys/S3Service
cd S3Service/
npm install

Don't forget to edit the parameters located in src/app/shared/consts/s3.const.ts.

ng build s3-service --prod
ng serve

Installation

Add @caliatys/s3-service module as dependency to your project.

npm install @caliatys/s3-service --save

Copy/paste src/app/shared/consts/s3.const.ts and replace the parameters with your resource identifiers.

export const S3Const = {
  bucket : 'XXXXXXXXXXXXXXX'
};

Copy/paste src/app/shared/helpers/s3.helper.ts. This file is used to simplify the implementation of the S3Service in your application while keeping a single instance of it.

// Angular modules
import { Injectable } from '@angular/core';

// External modules
import { S3Service }  from '@caliatys/s3-service';

// Consts
import { S3Const }    from '../consts/s3.const';

@Injectable()
export class S3Helper
{
  // Services
  public s3Service : S3Service = new S3Service(S3Const);

  // Consts
  public s3Const               = S3Const;
}

Include S3Helper into the providers of app.module.ts :

...
import { S3Helper } from './shared/helpers/s3.helper';

@NgModule({
  ...
  providers :
  [
    S3Helper
    ...
  ],
  ...
})
export class AppModule { }

Models

S3Object

export class S3Object
{
  public Key       : string;
  public Name      : string;
  public Extension : string;
  public Output    : AWS.S3.GetObjectOutput;
  public Blob      : Blob;
}

Methods

Get object

Retrieves objects from Amazon S3.

this.s3Helper.s3Service.getObject('objectKey.json').then(res => {}).catch(err => {});

Put object

Adds an object to a bucket.

this.s3Helper.s3Service.putObject(item, 'objectKey.json').then(res => {}).catch(err => {});

Copy object

Creates a copy of an object that is already stored in Amazon S3.

this.s3Helper.s3Service.copyObject('objectKey.json', 'newKey.json').then(res => {}).catch(err => {});

Delete object

this.s3Helper.s3Service.deleteObject('objectKey.json').then(res => {}).catch(err => {});

Delete objects

let del : AWS.S3.Delete;
del.Objects = [];
del.Objects.push({ Key : 'objectKey1.json' });
del.Objects.push({ Key : 'objectKey2.json', VersionId : 'XXXXXXXXX' });
this.s3Helper.s3Service.deleteObjects(del).then(res => {}).catch(err => {});

List objects

this.s3Helper.s3Service.listObjects().then(res => {}).catch(err => {});
// or
this.s3Helper.s3Service.listObjectsV2().then(res => {}).catch(err => {});

List object versions

this.s3Helper.s3Service.listObjectVersions('objectPrefix').then(res => {}).catch(err => {});

Restore object

this.s3Helper.s3Service.restoreObject('objectKey.json').then(res => {}).catch(err => {});

Helpers

Get folder objects

this.s3Helper.s3Service.getFolderObjects('image-folder').then(res => {}).catch(err => {});

Copy folder objects

this.s3Helper.s3Service.copyFolderObjects('from-folder', 'to-folder').then(res => {}).catch(err => {});

Dependencies

Important : This project uses the following dependencies :

"peerDependencies"  : {
  "@angular/common" : "^6.0.0 || ^7.0.0",
  "@angular/core"   : "^6.0.0 || ^7.0.0",
  "rxjs"            : "^6.0.0",
  "rxjs-compat"     : "^6.0.0",
  "aws-sdk"         : "^2.247.1"
},
"devDependencies"   : {
  "@types/node"     : "10.12.0"
}

If it's an empty Angular application :

Roadmap

In progress

  • Readme
  • Methods & helpers

Planning

  • Upload methods

Contributions

Contributions are welcome, please open an issue and preferably submit a pull request.

Development

S3Service is built with Angular CLI.