Comments (5)
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.
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.
FSharp.Data now also supports getting all stream directly
from http.fs.
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.
This in in v1.4.0.
from http.fs.
Related Issues (20)
- StreamContent bodies
- Beginner question: How to correctly download large files HOT 2
- Resource temporarily unavailable HOT 3
- Update FAQ to indicate using HttpClient not HttpWebRequest/Response under the hood HOT 1
- Question re. GZip and Decompression HOT 1
- Downloading of large files gets "Failed to get response" exception after 100 seconds? HOT 2
- How would I determine content-length, content-type, etc without actually downloading the file? HOT 4
- README corrections
- content-type header is not sent with GET request HOT 10
- Custom http method HOT 1
- Send body from stream HOT 1
- Setting Content Headers in requests HOT 2
- How to ignore TLS Certificate errors HOT 1
- Body not sent with DELETE request HOT 2
- Add request header If-Unmodified-Since HOT 2
- Exception thrown from Hopac HOT 5
- Can't get proxy working HOT 3
- How to enable TCP Keep Alive HOT 1
- Latest package version is compiled with .NET Core-based String.split overload making it incompatible with .NET Framework and .NET Standard 2.0 HOT 6
- Docs outdated? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from http.fs.