New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@caliatys/s3-service

Package Overview
Dependencies
Maintainers
5
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@caliatys/s3-service

Typescript service for AWS S3 with Angular

latest
npmnpm
Version
1.1.1
Version published
Maintainers
5
Created
Source
npm version

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.

Keywords

aws

FAQs

Package last updated on 17 Jun 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts