3.0.0 • Published 6 years ago

uh-storage v3.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

UH-Storage

Unified handler for storage System

Easy to use, separate storage handler between node environment

Now you can easy to separate storage handler between development, staging or production environment.

var gm = require('gm').subClass({ imageMagick: true });
var storage = require('./../../../uh-storage')(CONFIG['uh-storage']);

gm(req.file.path)
  .resize(125, 125)
  .compress('JPEG')
  .stream()
  .pipe(storage.stream(req.file, {}, function (err, result) {
      console.log(err, result);
   }))

Local configuration

You can easily set parameter in global CONFIG variable

GLOBAL.CONFIG = {
  'uh-storage': {
    provider: {
      use: 'local',
      params: {
        path: path.normalize(UPLOAD_PATH),
        url: URL_TO_UPLOAD_PATH
      }
    }
  }  
}

AWS S3 configuration

You can easily set parameter in global CONFIG variable

GLOBAL.CONFIG = {
  'uh-storage': {
    provider: {
      use: 's3',
      params: {
        accessKeyId: AWS_ACCESS_KEY_ID,
        accessKeySecret: AWS_ACCESS_KEY_SECRET,
        region: AWS_REGION,
        bucket: AWS_S3_BUCKET
      }
    }
  }
}
3.0.0

6 years ago

2.0.0

6 years ago

1.2.0

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago