Header menu logo FSharp.Core

WebExtensions Module

A module of extension members providing asynchronous operations for some basic Web operations.

Type extensions

Type extension Description

this.AsyncDownloadData

Full Usage: this.AsyncDownloadData

Parameters:
    address : Uri - The URI to retrieve.

Returns: Async<byte array> An asynchronous computation that will wait for the download of the URI.

Returns an asynchronous computation that, when run, will wait for the download of the given URI.

Extended Type: WebClient

address : Uri

The URI to retrieve.

Returns: Async<byte array>

An asynchronous computation that will wait for the download of the URI.

Example

 open System.Net
 open System.Text
 open System
 let client = new WebClient()
 client.AsyncDownloadData(Uri("https://www.w3.org")) |> Async.RunSynchronously |> Encoding.ASCII.GetString
namespace System
namespace System.Net
namespace System.Text
val client: WebClient
type WebClient = inherit Component new: unit -> unit member CancelAsync: unit -> unit member DownloadData: address: string -> byte array + 1 overload member DownloadDataAsync: address: Uri -> unit + 1 overload member DownloadDataTaskAsync: address: string -> Task<byte array> + 1 overload member DownloadFile: address: string * fileName: string -> unit + 1 overload member DownloadFileAsync: address: Uri * fileName: string -> unit + 1 overload member DownloadFileTaskAsync: address: string * fileName: string -> Task + 1 overload member DownloadString: address: string -> string + 1 overload ...
<summary>Provides common methods for sending data to and receiving data from a resource identified by a URI.</summary>
member WebClient.AsyncDownloadData: address: Uri -> Async<byte array>
Multiple items
type Uri = interface ISpanFormattable interface IFormattable interface ISerializable new: uriString: string -> unit + 6 overloads member Equals: comparand: obj -> bool member GetComponents: components: UriComponents * format: UriFormat -> string member GetHashCode: unit -> int member GetLeftPart: part: UriPartial -> string member IsBaseOf: uri: Uri -> bool member IsWellFormedOriginalString: unit -> bool ...
<summary>Provides an object representation of a uniform resource identifier (URI) and easy access to the parts of the URI.</summary>

--------------------
Uri(uriString: string) : Uri
Uri(uriString: string, creationOptions: inref<UriCreationOptions>) : Uri
Uri(uriString: string, uriKind: UriKind) : Uri
Uri(baseUri: Uri, relativeUri: string) : Uri
Uri(baseUri: Uri, relativeUri: Uri) : Uri
Multiple items
type Async = static member AsBeginEnd: computation: ('Arg -> Async<'T>) -> ('Arg * AsyncCallback * obj -> IAsyncResult) * (IAsyncResult -> 'T) * (IAsyncResult -> unit) static member AwaitEvent: event: IEvent<'Del,'T> * ?cancelAction: (unit -> unit) -> Async<'T> (requires delegate and 'Del :> Delegate) static member AwaitIAsyncResult: iar: IAsyncResult * ?millisecondsTimeout: int -> Async<bool> static member AwaitTask: task: Task<'T> -> Async<'T> + 1 overload static member AwaitWaitHandle: waitHandle: WaitHandle * ?millisecondsTimeout: int -> Async<bool> static member CancelDefaultToken: unit -> unit static member Catch: computation: Async<'T> -> Async<Choice<'T,exn>> static member Choice: computations: Async<'T option> seq -> Async<'T option> static member FromBeginEnd: beginAction: (AsyncCallback * obj -> IAsyncResult) * endAction: (IAsyncResult -> 'T) * ?cancelAction: (unit -> unit) -> Async<'T> + 3 overloads static member FromContinuations: callback: (('T -> unit) * (exn -> unit) * (OperationCanceledException -> unit) -> unit) -> Async<'T> ...

--------------------
type Async<'T>
static member Async.RunSynchronously: computation: Async<'T> * ?timeout: int * ?cancellationToken: Threading.CancellationToken -> 'T
type Encoding = interface ICloneable member Clone: unit -> obj member Equals: value: obj -> bool member GetByteCount: chars: nativeptr<char> * count: int -> int + 5 overloads member GetBytes: chars: nativeptr<char> * charCount: int * bytes: nativeptr<byte> * byteCount: int -> int + 7 overloads member GetCharCount: bytes: nativeptr<byte> * count: int -> int + 3 overloads member GetChars: bytes: nativeptr<byte> * byteCount: int * chars: nativeptr<char> * charCount: int -> int + 4 overloads member GetDecoder: unit -> Decoder member GetEncoder: unit -> Encoder member GetHashCode: unit -> int ...
<summary>Represents a character encoding.</summary>
property Encoding.ASCII: Encoding with get
<summary>Gets an encoding for the ASCII (7-bit) character set.</summary>
<returns>An encoding for the ASCII (7-bit) character set.</returns>
(extension) Encoding.GetString(bytes: inref<Buffers.ReadOnlySequence<byte>>) : string
Encoding.GetString(bytes: ReadOnlySpan<byte>) : string
Encoding.GetString(bytes: byte array) : string
Encoding.GetString(bytes: nativeptr<byte>, byteCount: int) : string
Encoding.GetString(bytes: byte array, index: int, count: int) : string

this.AsyncDownloadFile

Full Usage: this.AsyncDownloadFile

Parameters:
    address : Uri - The URI to retrieve.
    fileName : string - The file name to save download to.

Returns: Async<unit> An asynchronous computation that will wait for the download of the URI to specified file.

Returns an asynchronous computation that, when run, will wait for the download of the given URI to specified file.

Extended Type: WebClient

address : Uri

The URI to retrieve.

fileName : string

The file name to save download to.

Returns: Async<unit>

An asynchronous computation that will wait for the download of the URI to specified file.

Example

 open System.Net
 open System
 let client = new WebClient()
 Uri("https://www.w3.com") |> fun x -> client.AsyncDownloadFile(x, "output.html") |> Async.RunSynchronously
namespace System
namespace System.Net
val client: WebClient
type WebClient = inherit Component new: unit -> unit member CancelAsync: unit -> unit member DownloadData: address: string -> byte array + 1 overload member DownloadDataAsync: address: Uri -> unit + 1 overload member DownloadDataTaskAsync: address: string -> Task<byte array> + 1 overload member DownloadFile: address: string * fileName: string -> unit + 1 overload member DownloadFileAsync: address: Uri * fileName: string -> unit + 1 overload member DownloadFileTaskAsync: address: string * fileName: string -> Task + 1 overload member DownloadString: address: string -> string + 1 overload ...
<summary>Provides common methods for sending data to and receiving data from a resource identified by a URI.</summary>
Multiple items
type Uri = interface ISpanFormattable interface IFormattable interface ISerializable new: uriString: string -> unit + 6 overloads member Equals: comparand: obj -> bool member GetComponents: components: UriComponents * format: UriFormat -> string member GetHashCode: unit -> int member GetLeftPart: part: UriPartial -> string member IsBaseOf: uri: Uri -> bool member IsWellFormedOriginalString: unit -> bool ...
<summary>Provides an object representation of a uniform resource identifier (URI) and easy access to the parts of the URI.</summary>

--------------------
Uri(uriString: string) : Uri
Uri(uriString: string, creationOptions: inref<UriCreationOptions>) : Uri
Uri(uriString: string, uriKind: UriKind) : Uri
Uri(baseUri: Uri, relativeUri: string) : Uri
Uri(baseUri: Uri, relativeUri: Uri) : Uri
val x: Uri
member WebClient.AsyncDownloadFile: address: Uri * fileName: string -> Async<unit>
Multiple items
type Async = static member AsBeginEnd: computation: ('Arg -> Async<'T>) -> ('Arg * AsyncCallback * obj -> IAsyncResult) * (IAsyncResult -> 'T) * (IAsyncResult -> unit) static member AwaitEvent: event: IEvent<'Del,'T> * ?cancelAction: (unit -> unit) -> Async<'T> (requires delegate and 'Del :> Delegate) static member AwaitIAsyncResult: iar: IAsyncResult * ?millisecondsTimeout: int -> Async<bool> static member AwaitTask: task: Task<'T> -> Async<'T> + 1 overload static member AwaitWaitHandle: waitHandle: WaitHandle * ?millisecondsTimeout: int -> Async<bool> static member CancelDefaultToken: unit -> unit static member Catch: computation: Async<'T> -> Async<Choice<'T,exn>> static member Choice: computations: Async<'T option> seq -> Async<'T option> static member FromBeginEnd: beginAction: (AsyncCallback * obj -> IAsyncResult) * endAction: (IAsyncResult -> 'T) * ?cancelAction: (unit -> unit) -> Async<'T> + 3 overloads static member FromContinuations: callback: (('T -> unit) * (exn -> unit) * (OperationCanceledException -> unit) -> unit) -> Async<'T> ...

--------------------
type Async<'T>
static member Async.RunSynchronously: computation: Async<'T> * ?timeout: int * ?cancellationToken: Threading.CancellationToken -> 'T
This will download the server response as a file and output it as output.html

this.AsyncDownloadString

Full Usage: this.AsyncDownloadString

Parameters:
    address : Uri - The URI to retrieve.

Returns: Async<string> An asynchronous computation that will wait for the download of the URI.

Returns an asynchronous computation that, when run, will wait for the download of the given URI.

Extended Type: WebClient

address : Uri

The URI to retrieve.

Returns: Async<string>

An asynchronous computation that will wait for the download of the URI.

Example

 open System
 let client = new WebClient()
 Uri("https://www.w3.org") |> client.AsyncDownloadString |> Async.RunSynchronously
namespace System
val client: obj
Multiple items
type Uri = interface ISpanFormattable interface IFormattable interface ISerializable new: uriString: string -> unit + 6 overloads member Equals: comparand: obj -> bool member GetComponents: components: UriComponents * format: UriFormat -> string member GetHashCode: unit -> int member GetLeftPart: part: UriPartial -> string member IsBaseOf: uri: Uri -> bool member IsWellFormedOriginalString: unit -> bool ...
<summary>Provides an object representation of a uniform resource identifier (URI) and easy access to the parts of the URI.</summary>

--------------------
Uri(uriString: string) : Uri
Uri(uriString: string, creationOptions: inref<UriCreationOptions>) : Uri
Uri(uriString: string, uriKind: UriKind) : Uri
Uri(baseUri: Uri, relativeUri: string) : Uri
Uri(baseUri: Uri, relativeUri: Uri) : Uri
Multiple items
type Async = static member AsBeginEnd: computation: ('Arg -> Async<'T>) -> ('Arg * AsyncCallback * obj -> IAsyncResult) * (IAsyncResult -> 'T) * (IAsyncResult -> unit) static member AwaitEvent: event: IEvent<'Del,'T> * ?cancelAction: (unit -> unit) -> Async<'T> (requires delegate and 'Del :> Delegate) static member AwaitIAsyncResult: iar: IAsyncResult * ?millisecondsTimeout: int -> Async<bool> static member AwaitTask: task: Task<'T> -> Async<'T> + 1 overload static member AwaitWaitHandle: waitHandle: WaitHandle * ?millisecondsTimeout: int -> Async<bool> static member CancelDefaultToken: unit -> unit static member Catch: computation: Async<'T> -> Async<Choice<'T,exn>> static member Choice: computations: Async<'T option> seq -> Async<'T option> static member FromBeginEnd: beginAction: (AsyncCallback * obj -> IAsyncResult) * endAction: (IAsyncResult -> 'T) * ?cancelAction: (unit -> unit) -> Async<'T> + 3 overloads static member FromContinuations: callback: (('T -> unit) * (exn -> unit) * (OperationCanceledException -> unit) -> unit) -> Async<'T> ...

--------------------
type Async<'T>
static member Async.RunSynchronously: computation: Async<'T> * ?timeout: int * ?cancellationToken: Threading.CancellationToken -> 'T
This will download the server response from https://www.w3.org

this.AsyncGetResponse

Full Usage: this.AsyncGetResponse

Parameters:
Returns: Async<WebResponse> An asynchronous computation that waits for response to the WebRequest.

Returns an asynchronous computation that, when run, will wait for a response to the given WebRequest.

Extended Type: WebRequest

() : unit
Returns: Async<WebResponse>

An asynchronous computation that waits for response to the WebRequest.

Example

 open System.Net
 open System.IO
 let responseStreamToString = fun (responseStream : WebResponse) ->
     let reader = new StreamReader(responseStream.GetResponseStream())
     reader.ReadToEnd()
 let webRequest = WebRequest.Create("https://www.w3.org")
 let result = webRequest.AsyncGetResponse() |> Async.RunSynchronously |> responseStreamToString
namespace System
namespace System.Net
namespace System.IO
val responseStreamToString: responseStream: WebResponse -> string
val responseStream: WebResponse
type WebResponse = inherit MarshalByRefObject interface IDisposable interface ISerializable member Close: unit -> unit member Dispose: unit -> unit member GetResponseStream: unit -> Stream member ContentLength: int64 member ContentType: string member Headers: WebHeaderCollection member IsFromCache: bool ...
<summary>Provides a response from a Uniform Resource Identifier (URI). This is an <see langword="abstract" /> class.</summary>
val reader: StreamReader
Multiple items
type StreamReader = inherit TextReader new: stream: Stream -> unit + 12 overloads member Close: unit -> unit member DiscardBufferedData: unit -> unit member Peek: unit -> int member Read: unit -> int + 2 overloads member ReadAsync: buffer: char array * index: int * count: int -> Task<int> + 1 overload member ReadBlock: buffer: char array * index: int * count: int -> int + 1 overload member ReadBlockAsync: buffer: char array * index: int * count: int -> Task<int> + 1 overload member ReadLine: unit -> string ...
<summary>Implements a <see cref="T:System.IO.TextReader" /> that reads characters from a byte stream in a particular encoding.</summary>

--------------------
StreamReader(stream: Stream) : StreamReader
   (+0 other overloads)
StreamReader(path: string) : StreamReader
   (+0 other overloads)
StreamReader(stream: Stream, detectEncodingFromByteOrderMarks: bool) : StreamReader
   (+0 other overloads)
StreamReader(stream: Stream, encoding: System.Text.Encoding) : StreamReader
   (+0 other overloads)
StreamReader(path: string, detectEncodingFromByteOrderMarks: bool) : StreamReader
   (+0 other overloads)
StreamReader(path: string, options: FileStreamOptions) : StreamReader
   (+0 other overloads)
StreamReader(path: string, encoding: System.Text.Encoding) : StreamReader
   (+0 other overloads)
StreamReader(stream: Stream, encoding: System.Text.Encoding, detectEncodingFromByteOrderMarks: bool) : StreamReader
   (+0 other overloads)
StreamReader(path: string, encoding: System.Text.Encoding, detectEncodingFromByteOrderMarks: bool) : StreamReader
   (+0 other overloads)
StreamReader(stream: Stream, encoding: System.Text.Encoding, detectEncodingFromByteOrderMarks: bool, bufferSize: int) : StreamReader
   (+0 other overloads)
WebResponse.GetResponseStream() : Stream
StreamReader.ReadToEnd() : string
val webRequest: WebRequest
type WebRequest = inherit MarshalByRefObject interface ISerializable member Abort: unit -> unit member BeginGetRequestStream: callback: AsyncCallback * state: obj -> IAsyncResult member BeginGetResponse: callback: AsyncCallback * state: obj -> IAsyncResult member EndGetRequestStream: asyncResult: IAsyncResult -> Stream member EndGetResponse: asyncResult: IAsyncResult -> WebResponse member GetRequestStream: unit -> Stream member GetRequestStreamAsync: unit -> Task<Stream> member GetResponse: unit -> WebResponse ...
<summary>Makes a request to a Uniform Resource Identifier (URI). This is an <see langword="abstract" /> class.</summary>
val result: string
member WebRequest.AsyncGetResponse: unit -> Async<WebResponse>
Multiple items
type Async = static member AsBeginEnd: computation: ('Arg -> Async<'T>) -> ('Arg * AsyncCallback * obj -> IAsyncResult) * (IAsyncResult -> 'T) * (IAsyncResult -> unit) static member AwaitEvent: event: IEvent<'Del,'T> * ?cancelAction: (unit -> unit) -> Async<'T> (requires delegate and 'Del :> Delegate) static member AwaitIAsyncResult: iar: IAsyncResult * ?millisecondsTimeout: int -> Async<bool> static member AwaitTask: task: Task<'T> -> Async<'T> + 1 overload static member AwaitWaitHandle: waitHandle: WaitHandle * ?millisecondsTimeout: int -> Async<bool> static member CancelDefaultToken: unit -> unit static member Catch: computation: Async<'T> -> Async<Choice<'T,exn>> static member Choice: computations: Async<'T option> seq -> Async<'T option> static member FromBeginEnd: beginAction: (AsyncCallback * obj -> IAsyncResult) * endAction: (IAsyncResult -> 'T) * ?cancelAction: (unit -> unit) -> Async<'T> + 3 overloads static member FromContinuations: callback: (('T -> unit) * (exn -> unit) * (OperationCanceledException -> unit) -> unit) -> Async<'T> ...

--------------------
type Async<'T>
static member Async.RunSynchronously: computation: Async<'T> * ?timeout: int * ?cancellationToken: System.Threading.CancellationToken -> 'T

Type something to start searching.