aws-s3-push

push to aws-s3


Keywords
aws, s3, cdn
License
MIT
Install
npm install aws-s3-push@1.1.0

Documentation

aws-s3-push

A module for aws s3 cdn push with cache

Installation

  npm i aws-s3-push --save-dev

Use it

  const awsS3Push = require('aws-s3-push');
  const rootPath = './dist'; // that means /dist/* all file and child dir file
 

  const push = new awsS3Push({
    bucketName,
    bucketDir,
    cachePath,
    region,
    accessKeyId, 
    secretAccessKey, 
    s3Params:{
      // CacheControl:'max-age=5184000'
    }
  });

  push.upload(rootPath); 

  // or use async/await to get the upload result
  const result = await push.upload(rootPath); // if success,result will be 1
  

Api

constructor params

method params

  • upload(path): sync upload to s3
    • path: the file dir you want push to s3 bucket.
  • clearCache(): clear cache file