Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/storage/bucket.js
Original file line number Diff line number Diff line change
Expand Up @@ -964,6 +964,8 @@ Bucket.prototype.makePublic = function(options, callback) {
* `options.predefinedAcl = 'publicRead'`)
* @param {boolean} options.resumable - Force a resumable upload. (default:
* true for files larger than 5 MB).
* @param {string} options.offset - The starting byte of the upload stream, for
* resuming an interrupted upload. Defaults to 0.
* @param {function} callback - The callback function.
* @param {?error} callback.err - An error returned while making this request
* @param {module:storage/file} callback.file - The uploaded File.
Expand Down
5 changes: 4 additions & 1 deletion lib/storage/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -747,6 +747,8 @@ File.prototype.createResumableUpload = function(options, callback) {
* `options.predefinedAcl = 'private'`)
* @param {boolean} options.public - Make the uploaded file public. (Alias for
* `options.predefinedAcl = 'publicRead'`)
* @param {string} options.offset - The starting byte of the upload stream, for
* resuming an interrupted upload. Defaults to 0.
* @param {string|boolean} options.validation - Possible values: `"md5"`,
* `"crc32c"`, or `false`. By default, data integrity is validated with an
* MD5 checksum for maximum reliability. CRC32c will provide better
Expand Down Expand Up @@ -1536,7 +1538,8 @@ File.prototype.startResumableUpload_ = function(dup, options) {
metadata: options.metadata,
predefinedAcl: options.predefinedAcl,
private: options.private,
public: options.public
public: options.public,
offset: options.offset
});

uploadStream
Expand Down
15 changes: 15 additions & 0 deletions test/storage/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -1073,6 +1073,21 @@ describe('File', function() {
writable.end('data');
});

it('should pass through a provided offset', function(done) {
var options = {
offset: 1234
};

var writable = file.createWriteStream(options);

file.startResumableUpload_ = function(stream, options_) {
assert.deepEqual(options_.offset, options.offset);
done();
};

writable.write('data');
});

describe('validation', function() {
var data = 'test';

Expand Down