Skip to content

Mongo File Store lets you read files into Mongo, attach metadata to them and retrieve them based on that metadata

License

Notifications You must be signed in to change notification settings

SoftwareWithFriends/mfs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Mongo File Store lets you read files into Mongo, attach metadata to them and retrieve them based on that metadata

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages