Project

mfs

0.0
No commit activity in last 3 years
No release in over 3 years
MongoFileStore lets you load files into mongo and attach metadata.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.3
>= 0
>= 0

Runtime

>= 3.0.0
 Project Readme

Mongo File Store

Mongo File Store is a library for adding small files from the filesystem to MongoDB using Mongoid.

Status

Code Climate Build Status

Install

gem install mfs

Purpose

  • Shared Set of Files
  • Attach Metadata to Files
  • Retrieve Files based on metadata

Usage

require 'mfs'
entry = Mfs::Entry.load_file('path/to/file')
entry.filepath
entry.filename
entry.created_at
entry.data

# Set arbitrary Meta-data fields
Mfs::Entry.load_file('path/to/file',test_field: true)
entry = Mfs::Entry.where(test_field: true).first

# Load all files in a directory structure
entries = Mfs::Entry.load_directory('path/to/files')

# Load all files and set meta-data
entries = Mfs::Entry.load_directory('path/to/files') do |filename|
    {has_a: filename.include('a')}
end

Create your own file types. As an example see Mfs::Types::Certificate and its Spec

Limitations

  • No File Hierarchy
  • Does not use GridFS (<16MB files only)
  • Does not check for duplicate files