class Marten::Core::Storage::FileSystem

Overview

A basic file system storage that stores files locally.

Defined in:

marten/core/storage/file_system.cr

Constructors

Instance Method Summary

Instance methods inherited from class Marten::Core::Storage::Base

delete(filepath : String) : Nil delete, exists?(filepath : String) : Bool exists?, open(filepath : String) : IO open, save(filepath : String, content : IO) : String save, size(filepath : String) : Int64 size, url(filepath : String) : String url, write(filepath : String, content : IO) : Nil write

Constructor Detail

def self.new(root : String, base_url : String) #

[View source]

Instance Method Detail

def delete(filepath : String) : Nil #
Description copied from class Marten::Core::Storage::Base

Deletes the file associated with the passed filepath.


[View source]
def exists?(filepath : String) : Bool #
Description copied from class Marten::Core::Storage::Base

Returns true if the given filepath exists.


[View source]
def open(filepath : String) : IO #
Description copied from class Marten::Core::Storage::Base

Returns an IO for the given filepath.

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


[View source]
def size(filepath : String) : Int64 #
Description copied from class Marten::Core::Storage::Base

Returns the size of a file at a given filepath.


[View source]
def url(filepath : String) : String #
Description copied from class Marten::Core::Storage::Base

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


[View source]
def write(filepath : String, content : IO) : Nil #
Description copied from class Marten::Core::Storage::Base

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]