This module provides various operational support for http. The currently available interfaces are as follows:
::: tip API
http.download(url: <string>, outputfile: <string>, opt: <table>)
:::
| Parameter | Description |
|---|---|
| url | Required. URL to download |
| outputfile | Required. Output file path |
| opt | Optional. Option parameters, supports the following: - headers - HTTP headers- timeout - Timeout duration- useragent - User agent |
| Type | Description |
|---|---|
| boolean | Returns true on success, false on failure |
This interface is relatively simple, is simply download files.
import("net.http")
http.download("https://xmake.io", "/tmp/index.html")