GitXplorerGitXplorer
f

refile-filesystem-hashed

public
0 stars
0 forks
0 issues

Commits

List of commits on branch master.
Verified
ff3d6d35a720bdae40c757c7f0197a7d5da27af4

Merge pull request #1 from francois2metz/dependabot/bundler/addressable-2.8.0

ffrancois2metz committed 4 years ago
Verified
08fdd049a15e277465b5bea624569aac04c9955d

Bump addressable from 2.4.0 to 2.8.0

ddependabot[bot] committed 4 years ago
Verified
c40f2d81c2766ea296484af6a70434c0521c0c91

Update rack.

ffrancois2metz committed 5 years ago
Verified
eaee673e972e8100374adeec37497a794365a5a4

Update rack.

ffrancois2metz committed 6 years ago
Unverified
cb29fdb84cf0555af04a40c89e0e779b7b5b2d02

Update rack-protection.

ffrancois2metz committed 7 years ago
Unverified
ca869a62571db4739113467997365cd983c5158c

Bump vesion.

ffrancois2metz committed 9 years ago

README

The README file for this repository.

Refile::Backend::FileSystemHashed

Refile backend that's based on Refile::Backend::FileSystem and stores files in sub-directories based on the given file id instead of storing all files on one directory.

Refile's out-of-the-box backend Refile::Backend::FileSystem stores all files within one directory which can get very large and makes maintenance (ls, etc.) very slow. This gem extends the default behavior, it splits up the directory in tiny chunks based on the given file id. For example if there is a file with id 0601ae4450cdc210ab9d05da50c392ee1c4b1894e8b2bc9cc5cc9e41e691 it stores the file in the nested directory 06/01/ae/44/0601ae4450cdc210ab9d05da50c392ee1c4b1894e8b2bc9cc5cc9e41e691 within the given directory.

Usage

Add refile-filesystem-hashed to your Gemfile.

gem 'refile-filesystem-hashed', '~> 1.0.1', require: 'refile/backend/file_system_hashed'

Replace Refile::Backend::FileSystem with Refile::Backend::FileSystemHashed.

backend = Refile::Backend::FileSystemHashed.new("/uploads")
backend.path('0601ae4450cdc210ab9d05da50c392ee1c4b1894e8b2bc9cc5cc9e41e691')
=> "/uploads/06/01/ae/44/0601ae4450cdc210ab9d05da50c392ee1c4b1894e8b2bc9cc5cc9e41e691"

You can replace Refile::Backend::FileSystem at any time as the gem will automagically move existing files to the new hashed directory structure.