NodeJS + AWS SDK + S3 - how do I successfully upload a zip file?

I've been trying to upload gzipped log files to S3 using the AWS NodeJS sdk, and occasionally find that the uploaded file in S3 is corrupted/truncated. When I download the file and decompress using gunzip in a bash terminal, I get:

01-log_2014-09-22.tsv.gz: unexpected end of file.

When I compare file sizes, the downloaded file comes up just a tiny bit short of the original file size (which unzips fine).

This doesn't happen consistently...one out of every three files or so is truncated. Reuploading can fix the problem. Uploading through the S3 Web UI also works fine.

Here's the code I'm using...

var stream = fs.createReadStream(localFilePath);
this.s3 = new AWS.S3();
this.s3.putObject({
    Bucket: bucketName,
    Key: folderName + filename,
    ACL: "bucket-owner-full-control",
    Body: stream,
},function(err) {
//  stream.close();
    callback(err);
});

I shouldn't have to close the stream since it defaults to autoclose, but the problem seems to occur either way.

The fact that its intermittent suggests it's some sort of a timing or buffering issue, but I can't find any controls to fiddle with that might affect that. Any suggestions?

Thanks.