Skip to content

Commit

Permalink
Merge pull request #93 from vipulnsward/add-note
Browse files Browse the repository at this point in the history
Add note in README how to extend detection of custom file types
  • Loading branch information
vipulnsward authored Apr 12, 2023
2 parents ce39e57 + e92e628 commit 3af6778
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ Marcel::MimeType.for Pathname.new("example.png"), name: "example.ai"
# As "application/illustrator" is not a more specific type of "image/png", the filename is ignored
```

Custom file types not supported by Marcel can be added using `Marcel::MimeType.extend`.

```ruby
Marcel::MimeType.extend "text/custom", extensions: %w( customtxt )
Marcel::MimeType.for name: "file.customtxt"
# => "text/custom"
```

## Motivation

Marcel was extracted from Basecamp 3, in order to make our file detection logic both easily reusable but more importantly, easily testable. Test fixtures have been added for all of the most common file types uploaded to Basecamp, and other common file types too. We hope to expand this test coverage with other file types as and when problems are identified.
Expand Down

0 comments on commit 3af6778

Please sign in to comment.