Skip to content
This repository has been archived by the owner on Oct 20, 2021. It is now read-only.

Latest commit

 

History

History
21 lines (16 loc) · 577 Bytes

mimetype.md

File metadata and controls

21 lines (16 loc) · 577 Bytes

Mimetype

Validates if the file mimetype matches the expected one.

Valid values:

validator.mimetype('application/javascript').validate('js');
validator.mimetype('application/json').validate('json');
validator.mimetype('text/plain').validate('txt');
validator.mimetype(['application/json', 'text/plain']).validate('json');

Invalid values:

validator.mimetype('false').validate('foobar');
validator.mimetype('foo').validate('bar');
validator.mimetype('txt').validate('foo/txt');
validator.mimetype(['application/json', 'text/plain']).validate('foobar');