Skip to content

Add ChunkSize option to DownloadStream API for Azure Files #24667

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented May 22, 2025

This PR adds ChunkSize as an input parameter to the DownloadStreamOptions for Azure Files, allowing clients to specify larger chunk sizes when downloading files. This addresses a performance issue that occurs when downloading large files.

Changes

  • Added ChunkSize field to DownloadStreamOptions struct in models.go
  • Added ChunkSize field to httpGetterInfo struct to store the value
  • Updated DownloadStream method to pass the chunk size to the response
  • Updated NewRetryReader method to use the specified chunk size
  • Added tests to verify the functionality with different chunk sizes

The changes are minimal and maintain backward compatibility, as the ChunkSize field is optional with a default value that matches existing behavior.

Usage Example

// Set a custom chunk size for better performance with large files
resp, err := fileClient.DownloadStream(ctx, &file.DownloadStreamOptions{
    ChunkSize: 8 * 1024 * 1024, // Use 8MB chunks instead of default 4MB
})

Fixes #24650.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@Copilot Copilot AI changed the title [WIP] Give option to provide custom / higher chunk size while using DownloadStream API for Azure Files Add ChunkSize option to DownloadStream API for Azure Files May 22, 2025
@Copilot Copilot AI requested a review from vibhansa-msft May 22, 2025 16:25
Copilot finished work on behalf of vibhansa-msft May 22, 2025 16:25
@vibhansa-msft vibhansa-msft added the Storage Storage Service (Queues, Blobs, Files) label May 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Storage Storage Service (Queues, Blobs, Files)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Give option to provide custom / higher chunk size while using DownloadStream API for Azure Files
2 participants