Skip to content

Commit 3af6778

Browse files
authored
Merge pull request #93 from vipulnsward/add-note
Add note in README how to extend detection of custom file types
2 parents ce39e57 + e92e628 commit 3af6778

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ Marcel::MimeType.for Pathname.new("example.png"), name: "example.ai"
4141
# As "application/illustrator" is not a more specific type of "image/png", the filename is ignored
4242
```
4343

44+
Custom file types not supported by Marcel can be added using `Marcel::MimeType.extend`.
45+
46+
```ruby
47+
Marcel::MimeType.extend "text/custom", extensions: %w( customtxt )
48+
Marcel::MimeType.for name: "file.customtxt"
49+
# => "text/custom"
50+
```
51+
4452
## Motivation
4553

4654
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.

0 commit comments

Comments
 (0)