Giter Site home page Giter Site logo

codacy-badger / node-s3 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from d0whc3r/node-s3

0.0 0.0 0.0 430 KB

S3 api for node made easy with typescript

Home Page: https://hub.docker.com/r/d0whc3r/s3

Dockerfile 1.23% TypeScript 71.65% JavaScript 27.12%

node-s3's Introduction

๐Ÿ’พ Node s3

Utility to use s3 storage using nodejs. It could upload content to s3 storage to use as backup service.

๐Ÿ‘€ Project status

pipeline status codecov

Codacy Badge Quality Gate Status Maintainability Rating Security Rating Bugs Vulnerabilities

dependencies npm version

๐Ÿ”‘ Create keys

Access key and Secre key should be defined in environment variables check example.env for more info about environment variables

โ›ต Docker usage

You could use cli app in docker

๐Ÿšฃ Build docker image

docker build -t s3 .

๐Ÿ”ฐ Environment variables

  • ENDPOINT: Endpoint to connect, could be any s3 compatible endpoint (it could be defined in commandline with --endpoint or -e, example: http://s3.eu-central-1.amazonaws.com:9000)
  • ACCESS_KEY: Access key to use (required)
  • SECRET_KEY: Secret key to use (required)
  • BUCKET: Bucket name to connect (it could be created using -c or it could be defined in commandline with --bucket)
  • MAX_RETRIES: Maximum retry connections when fail (optional, example: 3)
  • FORCE_PATH_STYLE: Force path style (optional, example: true)
  • SSL_ENABLED: Enable ssl connection to endpoint (optional, example: false)

๐Ÿ Cli help output

Using docker image from hub.docker.com

docker run --rm d0whc3r/s3 --help
Help for s3node

  Usage of npm s3node in command line. 

Options

  -e, --endpoint url                             Destination url (can be defined by $ENDPOINT env variable)                    
  --bucket bucket                                Destination bucket (can be defined by $BUCKET env variable)                   
  -l, --list                                     List all files                                                                
  -b, --backup file*                             Backup files                                                                  
  -z, --zip zipname.zip                          Zip backup files                                                              
  -r, --replace                                  Replace files if already exists when backup upload                            
  -c, --create                                   Create destination upload bucket                                              
  -f, --folder foldername                        Folder name to upload file/s                                                  
  -d, --delete foldername=duration OR duration   Clean files older than duration in foldername                                 
  -m, --mysql                                    Mysql backup using environment variables to connect mysql server              
                                                 ($MYSQL_USER, $MYSQL_PASSWORD, $MYSQL_DATABASE, $MYSQL_HOST, $MYSQL_PORT)     
  -h, --help                                     Print this usage guide.                                                       

Examples

  1. List files in "sample" bucket.                                                                             $ s3node -e http://s3.eu-central-1.amazonaws.com --bucket sample -l                                         
  2. Backup multiple files to "backupFolder" folder.                                                            $ s3node -e http://s3.eu-central-1.amazonaws.com --bucket sample -b src/index.ts -b images/logo.png -f      
                                                                                                                backupFolder                                                                                                
  3. Backup files using wildcard to "backup" folder.                                                            $ s3node -e http://s3.eu-central-1.amazonaws.com --bucket sample -b src/* -b images/* -f backup             
  4. Backup files using wildcard and zip into "zipped" folder, bucket will be created if it doesn't exists.     $ s3node -e http://s3.eu-central-1.amazonaws.com --bucket sample -b src/* -b images/* -z -f zipped.zip -c   
  5. Backup files using wildcard and zip using "allfiles.zip" as filename into "zipped" folder, bucket will     $ s3node -e http://s3.eu-central-1.amazonaws.com --bucket sample -b src/* -b images/* -z allfiles.zip -f    
  be created if it doesn't exists and zipfile will be replaced if it exists                                     zipped -c -r                                                                                                
  6. Delete files in "uploads" folder older than 2days and files in "monthly" folder older than 1month          $ s3node -e http://s3.eu-central-1.amazonaws.com --bucket sample -d uploads=2d -d monthly=1M                
  7. Delete files in "uploads" folder older than 1minute                                                        $ s3node -e http://s3.eu-central-1.amazonaws.com --bucket sample -f uploads -d 1m                           
  8. Generate mysql dump file zip it and upload to "mysql-backup" folder                                        $ s3node -e http://s3.eu-central-1.amazonaws.com --bucket sample -f mysql-backup -m -z                      

node-s3's People

Contributors

d0whc3r avatar renovate-bot avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.