Simple Elixir wrapper around FWUP
iex()> fw = "/path/to/fwup_file.fw"
iex()> [[dev, _size]] = Fwup.devices()
iex()> args = ["-a", "-t", "complete", "-d", dev]
iex()> {:ok, fwup} = Fwup.stream(self(), args)
iex()> File.stream!(fw, [:bytes], 4096)
iex..> |> Stream.map(fn chunk ->
iex..> Fwup.send_chunk(fwup, chunk)
iex..> end)
iex..> |> Stream.run()
iex()> flush()
{:progress, 0}
{:progress, 1}
# many more
{:progess, 100}
{:ok, 0, ""}
If available in Hex, the package can be installed
by adding fwup
to your list of dependencies in mix.exs
:
def deps do
[
{:fwup, "~> 0.3.0"}
]
end
Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/fwup.