diff --git a/lib/storage/file.js b/lib/storage/file.js index 2ef2cddabce..0b5bda529d0 100644 --- a/lib/storage/file.js +++ b/lib/storage/file.js @@ -387,17 +387,18 @@ File.prototype.move = function(destination, callback) { * //- * var fs = require('fs'); * var myBucket = gcs.bucket('my-bucket'); - * var image = myBucket.file('image.png'); + * var remoteFile = myBucket.file('image.png'); + * var localFilename = '/Users/stephen/Photos/image.png'; * - * image.createReadStream() - * .pipe(fs.createWriteStream('/Users/stephen/Photos/image.png')) + * remoteFile.createReadStream() * .on('error', function(err) {}) * .on('response', function(response) { * // Server connected and responded with the specified status and headers. * }) * .on('complete', function() { * // The file is fully downloaded. - * }); + * }) + * .pipe(fs.createWriteStream(localFilename)); * * //- * // To limit the downloaded data to only a byte range, pass an options object. @@ -407,8 +408,8 @@ File.prototype.move = function(destination, callback) { * start: 10000, * end: 20000 * }) - * .pipe(fs.createWriteStream('/Users/stephen/logfile.txt')) - * .on('error', function(err) {}); + * .on('error', function(err) {}) + * .pipe(fs.createWriteStream('/Users/stephen/logfile.txt')); * * //- * // To read a tail byte range, specify only `options.end` as a negative @@ -418,8 +419,8 @@ File.prototype.move = function(destination, callback) { * logFile.createReadStream({ * end: -100 * }) - * .pipe(fs.createWriteStream('/Users/stephen/logfile.txt')) - * .on('error', function(err) {}); + * .on('error', function(err) {}) + * .pipe(fs.createWriteStream('/Users/stephen/logfile.txt')); */ File.prototype.createReadStream = function(options) { options = options || {};