Skip to content

Commit 3d6fa8a

Browse files
Ben Stahlstephenplusplus
authored andcommitted
Storage write streams should be able to use a pre-existing uri
1 parent a8e4d27 commit 3d6fa8a

5 files changed

Lines changed: 15 additions & 5 deletions

File tree

CONTRIBUTORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
# Keep the list alphabetically sorted.
1313

1414
Anand Suresh <[email protected]>
15+
Ben Stahl <[email protected]>
1516
Brett Bergmann <[email protected]>
1617
Burcu Dogan <[email protected]>
1718
Hector Rovira <[email protected]>

lib/storage/bucket.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -968,6 +968,8 @@ Bucket.prototype.makePublic = function(options, callback) {
968968
* @param {?error} callback.err - An error returned while making this request
969969
* @param {module:storage/file} callback.file - The uploaded File.
970970
* @param {object} callback.apiResponse - The full API response.
971+
* @param {string} options.uri - The URI for an already-created resumable
972+
* upload. See {module:storage/file#createResumableUpload}.
971973
* @param {string|boolean} options.validation - Possible values: `"md5"`,
972974
* `"crc32c"`, or `false`. By default, data integrity is validated with an
973975
* MD5 checksum for maximum reliability. CRC32c will provide better

lib/storage/file.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,8 @@ File.prototype.createResumableUpload = function(options, callback) {
747747
* `options.predefinedAcl = 'private'`)
748748
* @param {boolean} options.public - Make the uploaded file public. (Alias for
749749
* `options.predefinedAcl = 'publicRead'`)
750+
* @param {string} options.uri - The URI for an already-created resumable
751+
* upload. See {module:storage/file#createResumableUpload}.
750752
* @param {string|boolean} options.validation - Possible values: `"md5"`,
751753
* `"crc32c"`, or `false`. By default, data integrity is validated with an
752754
* MD5 checksum for maximum reliability. CRC32c will provide better
@@ -1547,7 +1549,8 @@ File.prototype.startResumableUpload_ = function(dup, options) {
15471549
metadata: options.metadata,
15481550
predefinedAcl: options.predefinedAcl,
15491551
private: options.private,
1550-
public: options.public
1552+
public: options.public,
1553+
uri: options.uri
15511554
});
15521555

15531556
uploadStream

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
"ent": "^2.2.0",
101101
"extend": "^3.0.0",
102102
"gce-images": "^0.2.0",
103-
"gcs-resumable-upload": "^0.5.0",
103+
"gcs-resumable-upload": "^0.6.0",
104104
"google-auto-auth": "^0.2.0",
105105
"google-proto-files": "^0.1.1",
106106
"grpc": "^0.14.1",

test/storage/file.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -994,7 +994,8 @@ describe('File', function() {
994994
it('should start a simple upload if specified', function(done) {
995995
var options = {
996996
metadata: METADATA,
997-
resumable: false
997+
resumable: false,
998+
customValue: true
998999
};
9991000
var writable = file.createWriteStream(options);
10001001

@@ -1009,7 +1010,8 @@ describe('File', function() {
10091010
it('should start a resumable upload if specified', function(done) {
10101011
var options = {
10111012
metadata: METADATA,
1012-
resumable: true
1013+
resumable: true,
1014+
customValue: true
10131015
};
10141016
var writable = file.createWriteStream(options);
10151017

@@ -2180,7 +2182,8 @@ describe('File', function() {
21802182
metadata: {},
21812183
public: true,
21822184
private: false,
2183-
predefinedAcl: 'allUsers'
2185+
predefinedAcl: 'allUsers',
2186+
uri: 'http://resumable-uri'
21842187
};
21852188

21862189
file.generation = 3;
@@ -2198,6 +2201,7 @@ describe('File', function() {
21982201
assert.strictEqual(opts.predefinedAcl, options.predefinedAcl);
21992202
assert.strictEqual(opts.private, options.private);
22002203
assert.strictEqual(opts.public, options.public);
2204+
assert.strictEqual(opts.uri, options.uri);
22012205

22022206
setImmediate(done);
22032207
return through();

0 commit comments

Comments
 (0)