Giter VIP home page Giter VIP logo

Comments (5)

relentless avatar relentless commented on June 3, 2024

I wouldn't want to expose the stream directly as it would make it more complex to use, and it's main purpose is to simplify the whole affair.

I could look at exposing the response body as bytes, would that work for you? The RequestDetailed method in FSharp.Data returns an option of text or binary depending on the response content-type (http://fsharp.github.io/FSharp.Data/library/Http.html), I could do something similar. But it would need to be done in such a way as to keep the basic case as simple as possible.

from http.fs.

xkrt avatar xkrt commented on June 3, 2024

Hi, thanks for the answer!
Unfortunatly this is unacceptable solution, because I want to download some large binary files (windows iso, for example) and this lead to the fact that response bytes will fill all the memory.

Look to commit in my fork of Http.fs: xkrt@ea5afa8

Example of usage:

let save sourceStream =
    use destStream = new FileStream("file.bin", FileMode.Create)
    sourceStream.CopyTo(destStream)

createRequest Get "http://example.com"  |> runOnResponseStream save

from http.fs.

ovatsus avatar ovatsus commented on June 3, 2024

FSharp.Data now also supports getting all stream directly

from http.fs.

relentless avatar relentless commented on June 3, 2024

I added getResponseStream, with your implementation. Thanks for that, and sorry for the wait. Better late than never, I guess.. Will get it on NuGet as v1.4.0 soon.

I don't really like the name, but I couldn't think of a better one. I wanted to stick with 'getResponse..' to try and keep it discoverable, although I can imagine it might be confusing that it returns a unit. Hopefully getting something by passing a function is relatively familiar with most people.

If anybody can think of a better name, speak up before I get it on NuGet!

from http.fs.

relentless avatar relentless commented on June 3, 2024

This in in v1.4.0.

from http.fs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.