pkgcloud/pkgcloud — pull request #332 by kenperkins (2014-10-07 18:03:47+00:00)
Title: Completely re-write upload streaming API

Fixes #326

With this change, all of the streaming APIs for storage, i.e. `client.upload` have been re-written.

1. `client.upload` no longer takes a callback
2. `client.upload` always returns a `writableStream`.
3. the returned stream emits:
- `error` anytime something went wrong
- `success`, with a `File` model as the data. We use success because behind the scenes we don't have complete control over when exactly the server has finished processing all of the data.
4. Options for `client.upload` are as follows:
- `remote`: the name of the remote named file **required**
- `container`: the container or containerName to use **required**
- `contentType`: the mime type for the file *optional*
- `size`: the size of the file *optional*
- `headers`: optional object to pass directly to the underlying storage provider HTTP request
This has been fully tested against Azure, Amazon and Openstack (Rackspace). There are still some edge cases I need to deal with:

- files over max size on Azure when specifying `size` in the options. Unspecified size options already use the multi-block upload codepath
- maxSize files for openstack.