var AWS = require('aws-sdk');
var fs = require('fs');

AWS.config.region = 'us-west-1';
var bucket = new AWS.S3({params: {Bucket: 'hourofnode.org'}});

var filename = '../web/main.js';
fs.readFile(filename, function (err, data) {
  var params = {Key: file, Body: data};
  bucket.putObject(params).done(function (resp) {
    console.log('Successfully uploaded package.');
  });
});

@@ -85,22 +85,18 @@
 1';%0Avar 
-bucket
+s3
  = new A
@@ -105,25 +105,23 @@
 .S3(
-%7Bparams: %7BB
+);%0Avar b
 ucket
-:
+ =
  'ho
@@ -137,13 +137,9 @@
 org'
-%7D%7D);%0A
+;
 %0Avar
@@ -155,11 +155,8 @@
  = '
-../
 web/
@@ -165,16 +165,17 @@
 in.js';%0A
+%0A
 fs.readF
@@ -227,16 +227,32 @@
 rams = %7B
+Bucket: bucket, 
 Key: fil
@@ -252,16 +252,20 @@
 ey: file
+name
 , Body: 
@@ -273,22 +273,31 @@
 ata%7D;%0A  
-bucket
+var result = s3
 .putObje
@@ -309,23 +309,18 @@
 rams
-).done(
+, 
 function
  (re
@@ -319,18 +319,102 @@
 tion
- (resp)
+(err, data) %7B%0A    if (err) %7B%0A      console.log(%22Error uploading data: %22, err);%0A    %7D else
  %7B%0A
+  
     
@@ -425,17 +425,17 @@
 ole.log(
-'
+%22
 Successf
@@ -452,19 +452,39 @@
 ded 
-package.');
+data to myBucket/myKey%22);%0A    %7D
 %0A  %7D

Fix callbacks