awssum-amazon-s3

AwsSum plugin for Amazon Simple Storage Service (S3).

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
awssum-amazon-s3
1.5.010 years ago11 years agoMinified + gzip package size for awssum-amazon-s3 in KB

Readme

NOTE: AwsSum is now deprecated. Please use aws-sdk instead.
awssum-amazon-s3 #
This is an ``AwsSum`` plugin!
You'll need to add awssum-amazon-s3 to your package.json dependencies. Both awssum and awssum-amazon are pulled in as peer dependencies.

Example ##

List all your buckets:
var fmt = require('fmt');
var amazonS3 = require('awssum-amazon-s3');

var s3 = new amazonS3.S3({
    'accessKeyId'     : process.env.ACCESS_KEY_ID,
    'secretAccessKey' : process.env.SECRET_ACCESS_KEY,
    'region'          : amazonS3.US_EAST_1
});

s3.ListBuckets(function(err, data) {
    fmt.dump(err, 'err');
    fmt.dump(data, 'data');
});

Streaming ##

Streaming uploads:
var fmt = require('fmt');
var amazonS3 = require('awssum-amazon-s3');

var s3 = new amazonS3.S3({
    'accessKeyId'     : process.env.ACCESS_KEY_ID,
    'secretAccessKey' : process.env.SECRET_ACCESS_KEY,
    'region'          : amazonS3.US_EAST_1
});

// you must run fs.stat to get the file size for the content-length header (s3 requires this)
fs.stat(__filename, function(err, file_info) {
    var bodyStream = fs.createReadStream( __filename );

    var options = {
        BucketName    : bucket,
        ObjectName    : 'amazon.js',
        ContentLength : file_info.size,
        Body          : bodyStream
    };

    s3.PutObject(options, function(err, data) {
        fmt.dump(err, 'err');
        fmt.dump(data, 'data');
    });
});

Streaming downloads:
var fmt = require('fmt');
var amazonS3 = require('awssum-amazon-s3');

var s3 = new amazonS3.S3({
    'accessKeyId'     : process.env.ACCESS_KEY_ID,
    'secretAccessKey' : process.env.SECRET_ACCESS_KEY,
    'region'          : amazonS3.US_EAST_1
});

var options = {
    BucketName    : 'pie-17',
    ObjectName    : 'javascript-file.js',
};

s3.GetObject(options, { stream : true }, function(err, data) {
    fmt.dump(err, 'err');
    fmt.dump(data, 'data');

    // stream this file to stdout
    fmt.sep();
    fmt.title('The File');
    data.Stream.pipe(process.stdout);
    data.Stream.on('end', function() {
        fmt.sep();
    });
});

Operations ##

ListBuckets ###

Docs: ListBuckets on AWS

DeleteBucket ###

Docs: DeleteBucket on AWS

DeleteBucketCors ###

Docs: DeleteBucketCors on AWS

DeleteBucketLifecycle ###

Docs: DeleteBucketLifecycle on AWS

DeleteBucketPolicy ###

Docs: DeleteBucketPolicy on AWS

DeleteBucketTagging ###

Docs: DeleteBucketTagging on AWS()

DeleteBucketWebsite ###

Docs: DeleteBucketWebsite on AWS

ListObjects ###

Docs: ListObjects on AWS

GetBucketAcl ###

Docs: GetBucketAcl on AWS

GetBucketCors ###

Docs: GetBucketCors on AWS

GetBucketLifecycle ###

Docs: GetBucketLifecycle on AWS

GetBucketPolicy ###

Docs: GetBucketPolicy on AWS

GetBucketTagging ###

Docs: GetBucketTagging on AWS()

GetBucketLocation ###

Docs: GetBucketLocation on AWS

GetBucketLogging ###

Docs: GetBucketLogging on AWS

GetBucketNotification ###

Docs: GetBucketNotification on AWS

GetBucketObjectVersions ###

Docs: GetBucketObjectVersions on AWS

GetBucketRequestPayment ###

Docs: GetBucketRequestPayment on AWS

GetBucketVersioning ###

Docs: GetBucketVersioning on AWS

GetBucketWebsite ###

Docs: GetBucketWebsite on AWS

CheckBucket ###

Docs: CheckBucket on AWS

ListMultipartUploads ###

Docs: ListMultipartUploads on AWS

CreateBucket ###

Docs: CreateBucket on AWS

PutBucketAcl ###

Docs: PutBucketAcl on AWS

PutBucketCors ###

Docs: PutBucketCors on AWS

PutBucketLifecycle ###

Docs: PutBucketLifecycle on AWS

PutBucketPolicy ###

Docs: PutBucketPolicy on AWS

PutBucketLogging ###

Docs: PutBucketLogging on AWS

PutBucketNotification ###

Docs: PutBucketNotification on AWS

PutBucketTagging ###

Docs: PutBucketTagging on AWS()

PutBucketRequestPayment ###

Docs: PutBucketRequestPayment on AWS

PutBucketVersioning ###

Docs: PutBucketVersioning on AWS

PutBucketWebsite ###

Docs: PutBucketWebsite on AWS

DeleteObject ###

Docs: DeleteObject on AWS

DeleteMultipleObjects ###

Docs: DeleteMultipleObjects on AWS

GetObject ###

Docs: GetObject on AWS

GetObjectAcl ###

Docs: GetObjectAcl on AWS

GetObjectTorrent ###

Docs: GetObjectTorrent on AWS

GetObjectMetadata ###

Docs: GetObjectMetadata on AWS

OptionsObject ###

Docs: OptionsObject on AWS

PostObjectRestore ###

Docs: PostObjectRestore on AWS

PutObject ###

Docs: PutObject on AWS

PutObjectAcl ###

Docs: PutObjectAcl on AWS

CopyObject ###

Docs: CopyObject on AWS

InitiateMultipartUpload ###

Docs: InitiateMultipartUpload on AWS

UploadPart ###

Docs: UploadPart on AWS

UploadPartCopy ###

Docs: UploadPartCopy on AWS

CompleteMultipartUpload ###

Docs: CompleteMultipartUpload on AWS

AbortMultipartUpload ###

Docs: AbortMultipartUpload on AWS

ListParts ###

Docs: ListParts on AWS
Author #
Written by Andrew Chilton - Blog - Twitter.
License #

(Ends)