abstract class Marten::Core::Storage::Base

Overview

Abstract base class representing a file storage.

Direct Known Subclasses

Defined in:

marten/core/storage/base.cr

Instance Method Summary

Instance Method Detail

abstract def delete(filepath : String) : Nil #

Deletes the file associated with the passed filepath.


[View source]
abstract def exists?(filepath : String) : Bool #

Returns true if the given filepath exists.


[View source]
abstract def open(filepath : String) : IO #

Returns an IO for the given filepath.

RaisesĀ Marten::Core::Storage::Errors::FileNotFound if the file does not exist.


[View source]
def save(filepath : String, content : IO) : String #

Save a file content into the storage by taking care of not overwriting any existing file.

The method returns the filepath of the saved file.


[View source]
abstract def size(filepath : String) : Int64 #

Returns the size of a file at a given filepath.


[View source]
abstract def url(filepath : String) : String #

Returns the URL associated with the passed file name or file path.


[View source]
abstract def write(filepath : String, content : IO) : Nil #

Write a file's content into the storage.

This is a destructive operation: any existing file with the same filepath will be overwritten.


[View source]