Shrine is a file attachments toolkit for Ruby applications

Shrine is a file attachments toolkit for Ruby applications
Average rating: 0
(0 votes)

Thanks! You’ve rated this material!

As you probably know reading our blog, Ruby is a dynamic, open source programming language with a focus on simplicity and productivity. And we want to prove that again by presenting you a new toolkit. Shrine is a file attachments toolkit for Ruby applications.

Some highlights of Shrine:

  • Modular design – the plugin system allows you to load only the functionality you need
  • Memory friendly – streaming uploads and downloads make it work great with large files
  • Cloud storage – store files on disk, AWS S3, Google Cloud, Cloudinary and others
  • ORM integrations – works with Sequel, ActiveRecord, Hanami::Model and Mongoid
  • Flexible processing – generate thumbnails on upload or on-the-fly using ImageMagick or libvips
  • Metadata validation – validate files based on extracted metadata
  • Direct uploads – upload asynchronously to your app or to the cloud using Uppy
  • Resumable uploads – make large file uploads resumable by pointing Uppy to a resumable endpoint
  • Background jobs – built-in support for background processing that supports any backgrounding library

A “storage” in Shrine is an object responsible for managing files on a specific storage service (disk, AWS S3, Google Cloud etc), which implements a generic method interface. Storages are configured directly and registered under a name in Shrine.storages, so that they can later be used by uploaders.

The main method of the uploader is #upload, which takes an IO-like object on the input, and returns a representation of the uploaded file on the output.

If you’re curious how it compares to other file attachment libraries, see the here.

Don’t miss a chance to find out about Rubyfmt, a Ruby autoformatter.

Rate this article, if you like it

Thanks! You’ve rated this material!

Got a project? Let's discuss it!

*By submitting this form you agree with our Privacy Policy.

Mailing & Legal Address

Syndicode Inc. 340 S Lemon Ave #3299, Walnut CA, 91789, USA

Visiting & Headquarters address
Kyiv Sofiivska 1/2a, 01001, Kyiv, Ukraine
Dnipro Hlinky 2, of. 1003, 49000, Dnipro, Ukraine
Email info@syndicode.com
Phone (+1) 9035021111