s3-latest
Pull down the most recent item in an Amazon S3 bucket.
Last updated 5 years ago by goodeggs .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install s3-latest 
SYNC missed versions from official npm registry.

s3-latest

NPM

A teeny tiny utility that retrieves the latest item in an Amazon S3 bucket. Designed as a great way to get the most recent backup of something. There are probably other uses.

Using from the command line

  1. Put AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY in your environment.
  2. npm install -g s3-latest
  3. s3-latest --bucket bucketname --before 2013-12-12 | tar -xzv

Using from node.js

var S3Latest = require('s3-latest');
var configuration = {
  bucket: 'bucketName',
  before: new Date("Mon, 02 Dec 2013 00:00:00 GMT")
}

// option 1:
S3Latest(configuration).pipe(process.stdout);

// option 2:
S3Latest(configuration, function(err, backup) {
  var fs = require('fs');
  if(err) return console.error(err.toString());
  backup.pipe(fs.createWriteStream(backup.Key));
});

Options

These can be passed in as command line options or as keys to the configuration object.

  • --bucket: S3 bucket name
  • --prefix: String to search for files with. Needs to be at the beginning of the key. Usually used for s3 folder names.
  • --before: A date (or a moment.js-compatible string representation of a date). Returns the latest object in the bucket after this date.

S3 Object details

When using the api with option 2 (see above), you can access the following information about the latest S3 object:

  • Owner: {ID: '<< AWS IAM User id>>', DisplayName: '<< AWS IAM Display Name >>'}
  • Size: size of the object in bytes
  • ETag: version information
  • LastModified: timestamp
  • Key: S3 Key

Current Tags

  • 1.1.0                                ...           latest (5 years ago)

7 Versions

  • 1.1.0                                ...           5 years ago
  • 1.0.1                                ...           5 years ago
  • 0.6.0                                ...           6 years ago
  • 0.5.0                                ...           7 years ago
  • 0.4.1                                ...           7 years ago
  • 0.2.0                                ...           7 years ago
  • 0.1.1                                ...           7 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 7
Dependencies (8)
Dev Dependencies (2)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |