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

Examples of uploading and downloading files with os-lib support. #2399

Merged
merged 7 commits into from
Jan 14, 2025

Conversation

adamwkaczmarek
Copy link
Contributor

@adamwkaczmarek adamwkaczmarek commented Jan 14, 2025

Before submitting pull request:

  • Check if the project compiles by running sbt compile
  • Verify docs compilation by running sbt compileDocs
  • Check if tests pass by running sbt test
  • Format code by running sbt scalafmt

@adamwkaczmarek adamwkaczmarek requested a review from adamw January 14, 2025 09:00
@main def uploadFileWithOsLib(): Unit = {
val request = basicRequest
.post(uri"http://httpbin.org/post")
.body(os.read.inputStream(path))
Copy link
Member

Choose a reason for hiding this comment

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

ok, looks easy enough :)

can we add an example of uploading the result of a execute command-line command? (even if it's a simple cat ...)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it should not be problem.

@@ -0,0 +1,20 @@
// {cat=Other; effects=Direct; backend=HttpClient}: Download file

//> using dep com.lihaoyi::os-lib:0.11.3
Copy link
Member

Choose a reason for hiding this comment

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

it also needs sttp ;) did you try running those locally?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry I didn't push all changes to Github , now should be good.
BTW all examples I tested locally using sbt and scala-cli.

@adamw adamw marked this pull request as ready for review January 14, 2025 10:52
@adamw adamw merged commit 45e75c3 into master Jan 14, 2025
21 checks passed
@adamw adamw deleted the sttp-with-os-lib-examples branch January 14, 2025 10:52
@adamw adamw mentioned this pull request Jan 14, 2025
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.

2 participants