Skip to content

Commit

Permalink
svg mime
Browse files Browse the repository at this point in the history
  • Loading branch information
davidfmiller committed Apr 11, 2017
1 parent 13a8758 commit 36c92ed
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,8 @@ const mimeForPath = function(arg) {
return 'image/gif';
case '.xml':
return 'text/xml';
case '.svg':
return 'image/svg+xml';

case '.tif':
case '.tiff':
Expand Down Expand Up @@ -337,6 +339,8 @@ const extensionForMime = function(mime) {
return 'jpg';
case 'image/gif':
return 'gif';
case 'image/svg+xml':
return 'svg';
case 'text/xml':
case 'application/xml':
return 'xml';
Expand Down
6 changes: 6 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ describe('RMR.mime', function() {
expect(RMR.mime.extensionFor('text/xml')).to.equal('xml');

expect(RMR.mime.extensionFor('application/pdf')).to.equal('pdf');

expect(RMR.mime.extensionFor('image/svg+xml')).to.equal('svg');

expect(RMR.mime.extensionFor('text/html')).to.equal('html');
expect(RMR.mime.extensionFor('text/css')).to.equal('css');

Expand All @@ -42,6 +45,9 @@ describe('RMR.mime', function() {
expect(RMR.mime.fromPath('image.jpg')).to.equal('image/jpeg');
expect(RMR.mime.fromPath('image.gif')).to.equal('image/gif');
expect(RMR.mime.fromPath('image.png')).to.equal('image/png');

expect(RMR.mime.fromPath('image.svg')).to.equal('image/svg+xml');

expect(RMR.mime.fromPath('page.html')).to.equal('text/html');
expect(RMR.mime.fromPath('doc.xml')).to.equal('text/xml');
expect(RMR.mime.fromPath('page.htm')).to.equal('text/html');
Expand Down

0 comments on commit 36c92ed

Please sign in to comment.