[erlang-questions] httpc request - stream to file
Yury Shefer
shefys@REDACTED
Mon Oct 12 18:16:26 CEST 2015
Hi,
I'm studying Erlang and have a simple question. In my http request function
i'm using stream to save the output to the file. The question is how to
replace the file content instead of adding additional data to it?
fetch_db_ver() ->
httpc:request(get,
{"http://www.domain.com/CURRENTDBVERSION",[]},
[],
[{stream, "CURRENTDBVERSION"}]
).
current_version() ->
file:read_file("CURRENTDBVERSION").
So, instead of
32154810
I'm getting "3215334632153346321533463215334632154810"
19> db:current_version().
{ok,<<"3215334632153346321533463215334632154810">>}
--
Thanks a lot,
Yury.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20151012/03af526d/attachment.htm>
More information about the erlang-questions
mailing list