Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Expose chunkSize param for CreateResumableUploadOptions #1754

Merged
merged 2 commits into from
Jan 13, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 src/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ export type PredefinedAcl =
| 'publicRead';

export interface CreateResumableUploadOptions {
chunkSize?: number;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need its own documentation somewhere, or is it covered by

* Create a separate request per chunk.
?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call-out, added some more discoverable documentation

configPath?: string;
metadata?: Metadata;
origin?: string;
Expand Down Expand Up @@ -3980,6 +3981,7 @@ class File extends ServiceObject<File> {
userProject: options.userProject || this.userProject,
retryOptions: retryOptions,
params: options?.preconditionOpts || this.instancePreconditionOpts,
chunkSize: options?.chunkSize,
});

uploadStream
Expand Down
2 changes: 2 additions & 0 deletions test/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4762,6 +4762,7 @@ describe('File', () => {
predefinedAcl: 'allUsers',
uri: 'http://resumable-uri',
userProject: 'user-project-id',
chunkSize: 262144, // 256 KiB
};

file.generation = 3;
Expand Down Expand Up @@ -4815,6 +4816,7 @@ describe('File', () => {
assert.strictEqual(opts.userProject, options.userProject);
assert.strictEqual(opts.retryOptions, storage.retryOptions);
assert.strictEqual(opts.params, storage.preconditionOpts);
assert.strictEqual(opts.chunkSize, options.chunkSize);

setImmediate(done);
return new PassThrough();
Expand Down