sandbox/pe/afile_client.erl

26 lines
461 B
Erlang
Raw Permalink Normal View History

2019-04-22 02:25:01 +00:00
-module(afile_client).
-compile([debug_info]).
-export([ls/1, get_file/2, put_file/3]).
ls(Server) ->
Server ! {self(), list_dir},
receive
{Server, FileList} ->
FileList
end.
get_file(Server, File) ->
Server ! {self(), {get_file, File}},
receive
{Server, Content} ->
Content
end.
put_file(Server, File, Contents) ->
Server ! {self(), {put_file, File, Contents}},
receive
{Server, Result} ->
Result
end.