PhxMediaLibrary.Storage.Memory (PhxMediaLibrary v0.6.1)

Copy Markdown View Source

In-memory storage adapter for testing.

Files are stored in an Agent process and are lost when the process stops.

Configuration

config :phx_media_library,
  disks: [
    memory: [
      adapter: PhxMediaLibrary.Storage.Memory,
      base_url: "/test-uploads"
    ]
  ]

Usage in Tests

setup do
  PhxMediaLibrary.Storage.Memory.clear()
  :ok
end

Summary

Functions

Get all stored files. Useful for debugging.

Returns a specification to start this module under a supervisor.

Clear all stored files. Useful in test setup.

Functions

all()

Get all stored files. Useful for debugging.

child_spec(arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

clear()

Clear all stored files. Useful in test setup.

start_link(opts \\ [])