Current section

Files

Jump to
mist src mist@file.erl
Raw

src/mist@file.erl

-module(mist@file).
-compile([no_auto_import, nowarn_unused_vars]).
-export([open/1, size/1, uri_unquote/1, sendfile/5]).
-export_type([file_mode/0, file_descriptor/0]).
-type file_mode() :: raw.
-type file_descriptor() :: any().
-spec open(bitstring()) -> {ok, file_descriptor()} |
{error, gleam@erlang@atom:atom_()}.
open(File) ->
file:open(File, [raw]).
-spec size(bitstring()) -> integer().
size(Field@0) ->
filelib:file_size(Field@0).
-spec uri_unquote(binary()) -> binary().
uri_unquote(Field@0) ->
uri_string:unquote(Field@0).
-spec sendfile(
file_descriptor(),
glisten@socket:socket(),
integer(),
integer(),
list(any())
) -> {ok, integer()} | {error, gleam@erlang@atom:atom_()}.
sendfile(Field@0, Field@1, Field@2, Field@3, Field@4) ->
file:sendfile(Field@0, Field@1, Field@2, Field@3, Field@4).