Skip to content

Instantly share code, notes, and snippets.

@wbashir
Created February 20, 2015 04:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wbashir/a6a749d8abc29f3bec8e to your computer and use it in GitHub Desktop.
Save wbashir/a6a749d8abc29f3bec8e to your computer and use it in GitHub Desktop.
Fiber Parent Callback
uploadS3: function (file, callback, callbackArgs) {
var s3 = new AWS.S3();
var options = {
partSize: 10 * 1024 * 1024,
queueSize: 1
};
s3.upload(file, options, function (error, data) {
if (callback) {
Meteor.wrapAsync(Meteor.call(callback, callbackArgs, {error: error, data: data})); //Barfs
}
});
}
@aaronthorp
Copy link

Something like this:

uploadS3: function (file, callback, callbackArgs) {
        var s3 = new AWS.S3();
        var uploadSync = Meteor.wrapAsync(s3.upload);
        var options = {
            partSize: 10 * 1024 * 1024,
            queueSize: 1
        };
        uploadSync(file, options, function (error, data) {
            if (callback) {
                Meteor.call(callback, callbackArgs, {error: error, data: data}); //Barfs 
            }
        });
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment