Depot.Adapter.Local (Depot v0.5.2) View Source

Depot Adapter for the local filesystem.

Direct usage

iex> {:ok, prefix} = Briefly.create(directory: true)
iex> filesystem = Depot.Adapter.Local.configure(prefix: prefix)
iex> :ok = Depot.write(filesystem, "test.txt", "Hello World")
iex> {:ok, "Hello World"} =, "test.txt")

Usage with a module

defmodule LocalFileSystem do
  use Depot.Filesystem,
    adapter: Depot.Adapter.Local,
    prefix: prefix

LocalFileSystem.write("test.txt", "Hello World")
{:ok, "Hello World"} ="test.txt")

Usage with Streams

The following options are available for streams:

  • :chunk_size - When reading, the amount to read, by :line (default) or by a given number of bytes.

  • :modes - A list of modes to use when opening the file for reading. For more information, see the docs for!/3.


{:ok, %File.Stream{}} = Depot.read_stream(filesystem, "test.txt")

# with custom read chunk size
{:ok, %File.Stream{line_or_bytes: 1_024, ...}} = Depot.read_stream(filesystem, "test.txt", chunk_size: 1_024)

# with custom file read modes
{:ok, %File.Stream{mode: [{:encoding, :utf8}, :binary], ...}} = Depot.read_stream(filesystem, "test.txt", modes: [encoding: :utf8])

Link to this section Summary

Link to this section Functions

Link to this function


View Source