README.md in format_parser-0.2.0 vs README.md in format_parser-0.3.0
- old
+ new
@@ -1,42 +1,45 @@
# format_parser
+
is a Ruby library for prying open video, image, document, and audio files.
It includes a number of parser modules that try to recover metadata useful for post-processing and layout while reading the absolute
minimum amount of data possible.
`format_parser` is inspired by [imagesize,](https://rubygems.org/gem/imagesize) [fastimage](https://github.com/sdsykes/fastimage)
and [dimensions,](https://github.com/sstephenson/dimensions) borrowing from them where appropriate.
+[![Gem Version](https://badge.fury.io/rb/format_parser.svg)](https://badge.fury.io/rb/format_parser) [![Build Status](https://travis-ci.org/WeTransfer/format_parser.svg?branch=master)](https://travis-ci.org/WeTransfer/format_parser)
+
## Currently supported filetypes:
`TIFF, PSD, PNG, MP3, JPEG, GIF, DPX, AIFF, WAV, FDX, MOV, MP4`
-...with more on the way!
+...with [more](https://github.com/WeTransfer/format_parser/issues?q=is%3Aissue+is%3Aopen+label%3Aformats) on the way!
## Basic usage
-Pass an IO object that responds to `read` and `seek` to `FormatParser` and an array of matches will be returned.
+Pass an IO object that responds to `read` and `seek` to `FormatParser` and the first confirmed match will be returned.
```ruby
-matches = FormatParser.parse(File.open("myimage.jpg", "rb"))
-matches.first.nature #=> :image
-matches.first.format #=> :jpg
-matches.first.width_px #=> 320
-matches.first.height_px #=> 240
-matches.first.orientation #=> :top_left
+match = FormatParser.parse(File.open("myimage.jpg", "rb"))
+match.nature #=> :image
+match.format #=> :jpg
+match.width_px #=> 320
+match.height_px #=> 240
+match.orientation #=> :top_left
```
-If you would rather receive only one result, call the gem as follows:
+If you would rather receive all potential results from the gem, call the gem as follows:
```ruby
-FormatParser.parse(File.open("myimage.jpg", "rb"), returns: :one)
+FormatParser.parse(File.open("myimage.jpg", "rb"), results: :all)
```
You can also optimize the metadata extraction by providing hints to the gem:
```ruby
-FormatParser.parse(File.open("myimage", "rb"), natures: [:video, :image], formats: [:jpg, :png, :mp4])
+FormatParser.parse(File.open("myimage", "rb"), natures: [:video, :image], formats: [:jpg, :png, :mp4], results: :all)
```
## Creating your own parsers
In order to create new parsers, these have to meet two requirements: