@@ -112,7 +112,7 @@ function File(bucket, name, options) {
112112 *
113113 * var myFile = gcs.bucket('my-bucket').file('my-file');
114114 *
115- * myFile.acl.add({
115+ * myFile.acl.add({
116116 * entity: 'allUsers',
117117 * role: gcs.acl.READER_ROLE
118118 * }, function(err, aclObject) {});
@@ -563,6 +563,51 @@ File.prototype.createReadStream = function(options) {
563563 return throughStream ;
564564} ;
565565
566+ /**
567+ * Create a unique resumable upload session URI. This is the first step when
568+ * performing a resumable upload.
569+ *
570+ * See the [Resumable upload guide](https://cloud.google.com/storage/docs/json_api/v1/how-tos/upload#resumable)
571+ * for more on how the entire process works.
572+ *
573+ * <h4>Note</h4>
574+ *
575+ * If you are just looking to perform a resumable upload without worrying about
576+ * any of the details, see {module:storage/createWriteStream}. Resumable uploads
577+ * are performed by default.
578+ *
579+ * @resource [Resumable upload guide]{@link https://cloud.google.com/storage/docs/json_api/v1/how-tos/upload#resumable}
580+ *
581+ * @param {object= } metadata - Optional metadata to set on the file.
582+ * @param {function } callback - The callback function.
583+ * @param {?error } callback.err - An error returned while making this request
584+ * @param {string } callback.uri - The resumable upload's unique session URI.
585+ *
586+ * @example
587+ * var bucket = gcs.bucket('my-bucket');
588+ * var file = bucket.file('large-file.zip');
589+ *
590+ * file.createResumableUpload(function(err, uri) {
591+ * if (!err) {
592+ * // `uri` can be used to PUT data to.
593+ * }
594+ * });
595+ */
596+ File . prototype . createResumableUpload = function ( metadata , callback ) {
597+ if ( is . fn ( metadata ) ) {
598+ callback = metadata ;
599+ metadata = { } ;
600+ }
601+
602+ resumableUpload . createURI ( {
603+ authClient : this . bucket . storage . makeAuthorizedRequest_ . authClient ,
604+ bucket : this . bucket . name ,
605+ file : this . name ,
606+ generation : this . generation ,
607+ metadata : metadata || { }
608+ } , callback ) ;
609+ } ;
610+
566611/**
567612 * Create a writable stream to overwrite the contents of the file in your
568613 * bucket.
@@ -1318,6 +1363,8 @@ File.prototype.makePublic = function(callback) {
13181363/**
13191364 * This creates a gcs-resumable-upload upload stream.
13201365 *
1366+ * @resource [gcs-resumable-upload]{@link https://github.com/stephenplusplus/gcs-resumable-upload}
1367+ *
13211368 * @param {Duplexify } stream - Duplexify stream of data to pipe to the file.
13221369 * @param {object= } metadata - Optional metadata to set on the file.
13231370 *
0 commit comments