file-cloud-aws-uploader
v0.0.4
Published
aws file uploader for file cloud
Downloads
13
Maintainers
Readme
aws file uploader for file cloud
Install
$ npm install --save file-cloud-aws-uploader
Usage
var fileCloudAwsUploader = require('file-cloud-aws-uploader');
var called = false;
var config = {
accessKeyId: process.env.AWS_S3_ACCESS_KEY_ID,
secretAccessKey: process.env.AWS_S3_ACCESS_KEY_SECRET,
endpoint: process.env.AWS_S3_ENDPOINT,
Bucket: process.env.AWS_S3_BUCKET,
region: 'ap-northeast-1',
progress: function (/*evt*/) {
called = true;
}
};
fileCloudAwsUploader(function (error, data) {
assert.equal(true, !error);
assert.equal(true, validator.isHexadecimal(data.ETag.replace(/\"/g, "")));
assert.equal(true, validator.isURL(data.Location));
assert.equal(true, called);
done();
}, path.resolve(__dirname, 'assets/a.jpg'), config);
$ npm install --global file-cloud-aws-uploader
$ faws3 --help
$ faws3 a.txt aws.json
$ faws3 a.jpg aws.json --type md5
$ faws3 a.jpg aws.json --type md5 --case upper
aws.json Format
General Configure
//aws.json formate
{
"accessKeyId": "YOUR_ID",
"secretAccessKey": "YOUR_SECRET",
"endpoint": "s3-cn-northeast-1.amazonaws.com.cn",
"Bucket": "subdomain.xxx.com",
"region": "ap-northeast-1",
}
Beijing China
Must additionally add:
"endpoint": "s3.cn-north-1.amazonaws.com.cn",
"region": "cn-north-1"
That is:
{
"accessKeyId": "YOUR_ID",
"secretAccessKey": "YOUR_SECRET",
"endpoint": "s3.cn-north-1.amazonaws.com.cn",
"Bucket": "subdomain.xxx.com",
"endpoint": "s3.cn-north-1.amazonaws.com.cn",
"region": "cn-north-1"
}
License
MIT © calidion