Skip to content
/ minne Public

Elixir Plug Parser for multipart form parsing

License

Notifications You must be signed in to change notification settings

harmon25/minne

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Minne

Multipart form parser for plug based applications that allows customizing the file handling behaviour. To be used as a replacement for the built in :multipart handler.

Installation

If available in Hex, the package can be installed by adding minne to your list of dependencies in mix.exs:

def deps do
  [
    {:minne, "~> 0.1.0"}
  ]
end

Usage

Tweak your Plug.Parsers config to include Minne

S3

Requires ExAws.S3 and its dependencies.

Will upload the file to S3 directly, never hitting the servers hardrive.

plug(Plug.Parsers,
  parsers: [
    {
      Minne,
      adapter: Minne.Adapter.S3
      adapter_opts: [bucket: "some-bucket", upload_prefix: "upload"],
    },
    :urlencoded,
    :json
  ],
  json_decoder: Jason
)

Temp

This behaves almost identically to the built in Plug.Upload, and writes the files to temp.

plug(Plug.Parsers,
  parsers: [
    {
      Minne,
      adapter: Minne.Adapter.Temp
    },
    :urlencoded,
    :json
  ],
  json_decoder: Jason
)

From the Controller

The built-in Plug.Parsers.MULTIPART represents files parsed from the body as a Plug.Upload struct. Minne does similar, but is instead a Minne.Upload, it is not a drop in replacment for Plug.Upload, but would not be hard to adapt code to use it.

About

Elixir Plug Parser for multipart form parsing

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages