1.1.2 • Published 2 years ago

@unparallel/cloud-storage-manager v1.1.2

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

Cloud-Storage-Manager

Library to standardize the interaction with different cloud services.

Supported cloud services

  • S3

Methods available

  • uploadFile(origin: string, destination: string, conf:any):any;
  • uploadFileBody(body: any, destination: string, conf:any):any;
  • getFile(path: string):any;
  • deleteFile(path: string):any;
  • deleteFolder(path: string):any;
  • moveFile(source: string, destination: string):any;
  • moveFolder(source: string, destination: string):any;
  • disconnect():any;
  • listFiles():any;
  • getFileURL(path:string):string;

Usage example

Using class directly

import {S3CloudStorageManager} from "@unparallel/cloud-storage-manager";
const s3CloudStorageManager = new S3CloudStorageManager({
    "accessKeyId" : "xxx",
    "secretAccessKey" : "xxx",
    "region" : "eu-west-1",
    "bucket" : "xxx"
})

s3CloudStorageManager.uploadFile("local/file.zip","file.zip")

Using the factory

import {CloudStorageManagerFactory} from "@unparallel/cloud-storage-manager";
const cloudStorageManager =  CloudStorageManagerFactory.create(
    "s3",
    {
        "accessKeyId" : "xxx",
        "secretAccessKey" : "xxx",
        "region" : "eu-west-1",
        "bucket" : "xxx"		
    }
	
)

cloudStorageManager.uploadFile("local/file.zip","file.zip")