1.0.4 • Published 7 years ago

content-check v1.0.4

Weekly downloads
41
License
MIT
Repository
github
Last release
7 years ago

Utility for working with the content-type header isomorphically.

Installation

npm install content-check

API

check(data: any): string|undefined

Attempt to guess the content type for some data. Returns undefined if it could not be guessed.

import * as fs from "fs";
import { check } from "content-check";

check("hello"); // "text/plain"
check("<body></body>"); // "text/html"
check({ a: 1 }); // "application/json"
check(new Buffer("hello")); // "application/octet-stream"
check(fs.createReadStream(__dirname + "/index.js")); // "application/javascript"

Contributions

  • Use npm test to run tests.

Please feel free to create a PR!

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.1.4

7 years ago

0.1.3

7 years ago

0.1.2

8 years ago

0.1.1

9 years ago

0.1.0

9 years ago