Module elli_util

Data Types

range()


  range() = {Offset::non_neg_integer(), Length::non_neg_integer()}
  

Function Index

encode_range/2 Encode Range to a Content-Range value.
file_size/1 Get the size in bytes of the file.
normalize_range/2 If a valid byte-range, or byte-range-set of size 1 is supplied, returns a normalized range in the format {Offset, Length}.

Function Details

encode_range/2


  encode_range(Range::range() | invalid_range, Size::non_neg_integer()) -> ByteRange::iolist()
  

Encode Range to a Content-Range value.

file_size/1


  file_size(Filename) -> Size | {error, Reason}
  

Get the size in bytes of the file.

normalize_range/2


  normalize_range(RangeOrSet, Size) -> Normalized
  

If a valid byte-range, or byte-range-set of size 1 is supplied, returns a normalized range in the format {Offset, Length}. Returns undefined when an empty byte-range-set is supplied and the atom invalid_range in all other cases.