@rocketmakers/storage-aws
TypeScript icon, indicating that this package has built-in type declarations

0.3.1 • Public • Published

@rocketmakers/storage-aws - AWS

This package provides a convenient interface for interacting with AWS S3 storage. It wraps the AWS SDK, offering simplified methods for common storage operations.

Installation

To use this package, install it via npm:

npm install @rocketmakers/storage-aws
yarn add @rocketmakers/storage-aws
pnpm add @rocketmakers/storage-aws

Usage

Below is an example of how to use the S3Storage class in your application:

import { S3Storage, IAwsConfig, IS3StorageConfig } from '@rocketmakers/storage-aws';

// Configuration for aws
const awsConfig: IAwsConfig = {
  region: 'your-aws-region',
  accessKeyId: 'your-access-key-id',
  secretAccessKey: 'your-secret-access-key',
};

// Storage configuration
const storageConfig: IS3StorageConfig = {
  aws: awsConfig,
  bucketName: 'your-s3-bucket-name',
};

// Create an instance of S3Storage
const s3Storage = new S3Storage(storageConfig);

// Example: Validate storage
const validationResult = await s3Storage.validate();
console.log('Storage validation result:', validationResult);

// Example: Copy a file
const fromFilePath = 'path/to/source/file.txt';
const toFilePath = 'path/to/destination/file.txt';
const copyResult = await s3Storage.fileCopy(fromFilePath, toFilePath);
console.log('File copy result:', copyResult);

// ... Other operations (delete, read, create, etc.)

Readme

Keywords

none

Package Sidebar

Install

npm i @rocketmakers/storage-aws

Weekly Downloads

102

Version

0.3.1

License

MIT

Unpacked Size

21.9 kB

Total Files

7

Last publish

Collaborators

  • rocketmakers-admin
  • adamrocketmakers
  • joerocketmakers
  • rocketsoper