Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F22591007
README.md
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
766 B
Referenced Files
None
Subscribers
None
README.md
View Options
#
HTTP
client
for
Nasqueron
Datasources
components
The
crate
ds
-
http
-
client
is
a
HTTP
client
based
on
Hyper
/
reqwest
components
.
It
can
be
used
to
download
a
file
on
an
HTTP
server
,
or
query
an
API
with
User
-
Agent
header
.
##
Usage
example
###
Initialize
a
client
```
use
ds_http_client
::
Client
;
let
mut
headers
=
HashMap
::
new
();
headers
.
insert
(
"User-Agent"
.
to_string
(),
"foo/1.2.3"
.
to_string
(),
);
let
client
=
Client
::
new
(
Some
(
headers
));
```
###
Download
a
file
```
let
url
=
"http://www.example.com/example.tar.gz"
;
let
target_path
=
"/tmp/example.tar.gz"
;
if
let
Err
(
error
)
=
client
().
download
(&
url
,
&
target_path
).
await
{
eprintln
!(
"Can't download file: {:?}"
,
error
);
}
```
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Jan 31, 17:57 (3 h, 32 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3403940
Default Alt Text
README.md (766 B)
Attached To
Mode
rDS Nasqueron Datasources
Attached
Detach File
Event Timeline
Log In to Comment