Page
Library
Module
Module type
Parameter
Class
Class type
Source
FetchSourceThis module provides functions to fetch content from URIs, supporting both local file paths and remote HTTP/HTTPS URLs.
fetch_local_uri uri reads the content of a local file.
val fetch_uri_lwt :
?debug:bool ->
allow_remote:bool ->
Uri.t ->
(string, string) result Lwt.tfetch_uri_lwt ?debug ~allow_remote uri asynchronously fetches content from a URI.
Supports the following URI schemes:
file://: Local file accesshttp:// and https://: Remote HTTP fetching (requires allow_remote = true)Note: Remote fetches have no built-in timeout. Consider using Lwt.pick with Lwt_unix.timeout for timeout control.
fetch_uri_sync ?debug ~allow_remote uri synchronously fetches content from a URI.
This is a blocking wrapper around fetch_uri_lwt that runs the Lwt event loop until the fetch completes.
Warning: This function blocks the current thread. For concurrent fetching, use fetch_uri_lwt directly.