Skip to content

Commit 6251c51

Browse files
committed
Set default return type to maps.
1 parent c9b80eb commit 6251c51

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ To add `erlang_exif` as a dependency to your rebar-based project, simply add the
2525

2626
## Example
2727

28-
The `erlang_exif:read(Path)` function actually calls `erlang_exif:read(Path, dict)` (for backward compatibility).
28+
The `erlang_exif:read(Path)` function actually calls `erlang_exif:read(Path, map)`.
2929

3030
The `erlang_exif:read(Path, ReturnType)` function returns `{ok, Exif}` where `Exif` is a `dict:dict()` or a map
3131
of the values read from the JPEG image. `ReturnType` has two valid values: `dict` and `maps`.

src/erlang_exif.erl

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
-define(DEBUG(_Fmt, _Args), ok).
2121
-endif.
2222

23-
-type exif() :: dict:dict() | map().
23+
-type exif() :: exif_map() | exif_dict().
24+
-type exif_dict() :: dict:dict().
25+
-type exif_map() :: #{ atom() => term() }.
2426

2527
-type data_module() :: erlang_exif_dict | erlang_exif_maps.
2628
-type return_type() :: dict | maps.
@@ -80,14 +82,15 @@ read_binary(Data, ReturnType) when is_binary(Data) ->
8082
find_and_parse_exif(ImageData, data_mod(ReturnType)).
8183

8284
%%
83-
%% @doc Read the Exif data from a named file (or binary data).
85+
%% @doc Read the Exif data from a named file (or binary data) and return a
86+
%% a map with the read data.
8487
%%
85-
-spec read(File) -> {ok, Exif} | {error, Reason}
86-
when File :: file:filename_all(),
87-
Exif :: exif(),
88-
Reason :: term().
88+
-spec read(File) -> {ok, ExifMap} | {error, Reason}
89+
when File :: file:filename_all(),
90+
ExifMap :: exif_map(),
91+
Reason :: term().
8992
read(File) when is_list(File); is_binary(File) ->
90-
read(File, dict).
93+
read(File, maps).
9194

9295
%%
9396
%% @doc Read the Exif data from a named file (or binary data)

0 commit comments

Comments
 (0)