0.0
Low commit activity in last 3 years
No release in over a year
A simple file storeage.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 2.2.33
>= 13.0
>= 3.0
 Project Readme

Filestorage

A simple file storage.

Installation

Add this line to your application's Gemfile:

gem "filestorage"

And then execute:

$ bundle

Or install it yourself as:

$ gem install filestorage

Store to local file system

Create a instance.

require "filestorage"
storage = Filesotrage::Local.new(base_dir)

Store a file to path.

storage.store(file, "foo/bar/baz.txt")

And get the file. get method returns instance of File class.

file = storage.get("foo/bar/baz.txt")
content = file.read

Store to local with random file name

Use Fielstorage::LocalRandom class.

Create a instance.

require "filestorage"
storage = Filesotrage::LocalRandom.new(base_dir, length)

length is for filename, default to 8.

Store a file.

storage.store(file)

Returns path to stored file, e.g. "5Q/CY/5QCyP0gT.txt"

And get the file. get method returns instance of File class.

file = storage.get("5Q/CY/5QCyP0gT.txt")
content = file.read

License

MIT license