Fosi Fossil Service
Small teams. Open source. Built on Fossil.

CaaS / Lamina

Unified Management for Fossil Repositories

Public | Owner: CaaS | Default branch: trunk | Last update: 2026-10-25 00:41

Artifact 726692638cbd054033d1a079bfd60c3389270c3b9bb3e07a9c4788d19e39f09b:


%%%-------------------------------------------------------------------
-module(nova_multipart_memory_handler).
-moduledoc """
`nova_multipart_handler` that keeps a file part in memory. Bounded by the plugin's `max_part_size` and `max_total_size`, so use it for small attachments only.

Result: `#{body => Binary}`.
""".
-behaviour(nova_multipart_handler).

-export([init/2, handle_data/2, handle_end/1, handle_abort/2]).

-spec init(nova_multipart_handler:part_info(), InitArgs :: term()) -> {ok, binary()}.
init(_PartInfo, _InitArgs) ->
    {ok, <<>>}.

-spec handle_data(Data :: binary(), Acc :: binary()) -> {ok, binary()}.
handle_data(Data, Acc) ->
    {ok, <<Acc/binary, Data/binary>>}.

-spec handle_end(Acc :: binary()) -> {ok, #{body := binary()}}.
handle_end(Acc) ->
    {ok, #{body => Acc}}.

-spec handle_abort(Reason :: term(), Acc :: binary()) -> ok.
handle_abort(_Reason, _Acc) ->
    ok.

Clone

You can clone this repository with the following command:

fossil clone https://fosi.dev/CaaS/Lamina

Contribute

The best way to contribute is through e-mail. See the project documentation for more details.