0.3.1 • Published 9 years ago

guess-api v0.3.1

Weekly downloads
1
License
MIT
Repository
github
Last release
9 years ago

Guess-api

Guessing api content type. Support text/plain, text/csv, text/xml, application/json. Useful in super large data, cause we use STREAM!

Install

npm install guess-api

Example

var guess = require('./');

guess('http://localhost:3000/xml', {encoding: 'utf8'}, cb)

function cb(type) {
    console.log(type)
    // result:
    // text/xml
}

Support

Types

  • text/csv
  • text/xml
  • application/json

protocol

  • http
  • https

How it work?

Only read the first chunk (why reading only the first chunk? cause will reduce lot of time of guessing super large data), and guess the encoding by using the first chunk.

License

MIT