|
|
|
@ -6,17 +6,17 @@ defmodule Asciinema.FileStore do
|
|
|
|
|
@callback serve_file(conn :: %Plug.Conn{}, path :: String.t, filename :: String.t) :: %Plug.Conn{}
|
|
|
|
|
|
|
|
|
|
@doc "Opens the given path in store"
|
|
|
|
|
@callback open(path :: String.t) :: {:ok, File.io_device} | {:error, File.posix}
|
|
|
|
|
@callback open_file(path :: String.t) :: {:ok, File.io_device} | {:error, File.posix}
|
|
|
|
|
|
|
|
|
|
@doc "Opens the given path in store, executes given fn and closes the file"
|
|
|
|
|
@callback open(path :: String.t, function :: (File.io_device -> res)) :: {:ok, res} | {:error, File.posix} when res: var
|
|
|
|
|
@callback open_file(path :: String.t, function :: (File.io_device -> res)) :: {:ok, res} | {:error, File.posix} when res: var
|
|
|
|
|
|
|
|
|
|
def put_file(dst_path, src_local_path, content_type) do
|
|
|
|
|
instance().put_file(dst_path, src_local_path, content_type)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def open_file(path, f) do
|
|
|
|
|
instance().open(path, f)
|
|
|
|
|
instance().open_file(path, f)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def download_file(store_path, local_path) do
|
|
|
|
|