Update docs: updated readFile version for async await#1117
Open
swifty-amay wants to merge 2 commits intovapor:mainfrom
Open
Update docs: updated readFile version for async await#1117swifty-amay wants to merge 2 commits intovapor:mainfrom
swifty-amay wants to merge 2 commits intovapor:mainfrom
Conversation
ptoffy
requested changes
Apr 8, 2026
Member
ptoffy
left a comment
There was a problem hiding this comment.
Thanks for this! We can expand it to loop over the chunks AsyncSequence which will be what most users will do
Author
|
Thanks for the review, actually you're right, devs must also get to know how to loop over the chunks. |
ptoffy
requested changes
Apr 11, 2026
Member
ptoffy
left a comment
There was a problem hiding this comment.
readContent is undefined here. Let's just keep the behaviour we had before where we simply print the ByteBuffer chunk
Author
|
Yes, you're right. Well, let me see if I can do something with this readContent, if not then I'll update this to the previous version where the chunks were being printed directly. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
###Changes
Updated the depricated version of readFile method for reading files asynchronously.
Changes
try await req.fileio.readFile(at: "/path/to/file") { chunk in
print(chunk) // ByteBuffer
}
(Depricated version)
to
let file = try await request.fileio.readFile(at: path, chunkSize: 16 * 1024) // 32Kb, ~5 chunks