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

KTOR-7801 and KTOR-7802 Document streamProvider deprecation and update the file upload example #571

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

vnikolova
Copy link
Collaborator

KTOR-7801 Document migrating from streamProvider to provider in multipart content
Preview Migration guide

KTOR-7802 Add documentation and sample on how to save multipart form data in a file
Preview Multipart form data

@vnikolova vnikolova requested review from Stexxe and osipxd January 3, 2025 13:11
topics/migrating-3.md Outdated Show resolved Hide resolved
topics/migrating-3.md Show resolved Hide resolved
topics/migrating-3.md Outdated Show resolved Hide resolved

If you need to receive a file sent as a part of a multipart request, call
the [.receiveMultipart()](https://api.ktor.io/ktor-server/ktor-server-core/io.ktor.server.request/receive-multipart.html)
function and then loop over each part as required.
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be useful to explain why looping is necessary and why a specific part cannot be queried.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Can you tell me where I can find more information on this process?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I added a short explanation. Let me know if I missed something 🙏

topics/server-requests.md Outdated Show resolved Hide resolved
topics/server-requests.md Outdated Show resolved Hide resolved
@vnikolova vnikolova self-assigned this Jan 7, 2025
@vnikolova vnikolova requested review from koshachy and e5l January 7, 2025 11:42
@vnikolova vnikolova requested a review from Stexxe January 7, 2025 15:15
Copy link
Collaborator

@koshachy koshachy left a comment

Choose a reason for hiding this comment

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

Great job!
I've added minor suggestions.
Please let me know if there are any questions.

topics/server-requests.md Outdated Show resolved Hide resolved
topics/migrating-3.md Outdated Show resolved Hide resolved
You can then stream data directly from the channel to the file output, using the
[`.copyTo()`](https://api.ktor.io/ktor-io/io.ktor.utils.io/copy-to.html) or
[`.copyAndClose()`](https://api.ktor.io/ktor-io/io.ktor.utils.io/copy-and-close.html)
methods provided by `ByteReadChannel`.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we separate "method" and "function" terms?
Or do we use both interchangeably?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I use them interchangeably. Is there a difference?

Copy link
Collaborator

Choose a reason for hiding this comment

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

AFIAK, in Kotlin we usually use them in different contexts.
I think we can return to this topic later. Feel free to merge ;)

topics/migrating-3.md Outdated Show resolved Hide resolved
```

```kotlin
fun Application.main() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Out-of-curiosity question: why code blocks throughout a file have different indentations?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It was not intended. I think my IDE is not detecting these inconsistencies, although I noticed the <compare> element doesn't include empty lines for example. I'll check what's happening...

topics/server-requests.md Outdated Show resolved Hide resolved
topics/server-requests.md Outdated Show resolved Hide resolved
topics/server-requests.md Outdated Show resolved Hide resolved
topics/server-requests.md Outdated Show resolved Hide resolved
topics/server-requests.md Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants