Packages

A Gleam FTP/FTPS client library with full RFC support for both passive and active mode

Current section

Files

Jump to
gftp src gftp@file_type.erl
Raw

src/gftp@file_type.erl

-module(gftp@file_type).
-compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch, inline]).
-define(FILEPATH, "src/gftp/file_type.gleam").
-export([to_string/1]).
-export_type([format_control/0, file_type/0]).
-if(?OTP_RELEASE >= 27).
-define(MODULEDOC(Str), -moduledoc(Str)).
-define(DOC(Str), -doc(Str)).
-else.
-define(MODULEDOC(Str), -compile([])).
-define(DOC(Str), -compile([])).
-endif.
?MODULEDOC(" File type options for FTP\n").
-type format_control() :: default | non_print | telnet | asa.
-type file_type() :: {ascii, format_control()} |
{ebcdic, format_control()} |
image |
binary |
{local, integer()}.
-file("src/gftp/file_type.gleam", 31).
-spec format_control_to_string(format_control()) -> binary().
format_control_to_string(Format_control) ->
case Format_control of
default ->
<<"N"/utf8>>;
non_print ->
<<"N"/utf8>>;
telnet ->
<<"T"/utf8>>;
asa ->
<<"C"/utf8>>
end.
-file("src/gftp/file_type.gleam", 39).
-spec to_string(file_type()) -> binary().
to_string(File_type) ->
case File_type of
{ascii, Format_control} ->
<<"A "/utf8, (format_control_to_string(Format_control))/binary>>;
{ebcdic, Format_control@1} ->
<<"E "/utf8, (format_control_to_string(Format_control@1))/binary>>;
image ->
<<"I"/utf8>>;
binary ->
<<"I"/utf8>>;
{local, Bits} ->
<<"L "/utf8, (erlang:integer_to_binary(Bits))/binary>>
end.