Simple RUBY file distribution library.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
test
.gitignore
.ruby-version
.travis.yml
LICENSE
README.md
Rakefile
file_distribution.gemspec

README.md

Simple RUBY file distribution library.

Build Status

Description:

Simple library that allows organize distribution of files within hex based tree.

Install file_distribution GEM:

gem install file_distribution

Example of usage:

require 'rubygems'
require 'file_distribution'

fd = FileDistribution.new("/tmp/storage")

# default extensions
database_id = 1
fd.hex_path(database_id)
fd.rename_from("/tmp/upload/file1.txt")
path = fd.get_path # saved file path

# set all extensions to .pdf
database_id = 256
fd.set_extension(".pdf")
fd.hex_path(database_id)
fd.rename_from("/tmp/upload/file2.txt")
path = fd.get_path # saved file path

Files should be stored in /tmp/storage/01.dat and /tmp/storage/01/00.pdf