I borrowed it from lib/s3storage.js. :-)