119 lines
4.6 KiB
Markdown
119 lines
4.6 KiB
Markdown
|
|
<!-- TITLE/ -->
|
|
|
|
# Is Text or Binary?
|
|
|
|
<!-- /TITLE -->
|
|
|
|
|
|
<!-- BADGES/ -->
|
|
|
|
[](http://travis-ci.org/bevry/istextorbinary "Check this project's build status on TravisCI")
|
|
[](https://npmjs.org/package/istextorbinary "View this project on NPM")
|
|
[](https://npmjs.org/package/istextorbinary "View this project on NPM")
|
|
[](https://david-dm.org/bevry/istextorbinary)
|
|
[](https://david-dm.org/bevry/istextorbinary#info=devDependencies)<br/>
|
|
[](https://www.gratipay.com/bevry/ "Donate weekly to this project using Gratipay")
|
|
[](http://flattr.com/thing/344188/balupton-on-Flattr "Donate monthly to this project using Flattr")
|
|
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QB8GQPZAH84N6 "Donate once-off to this project using Paypal")
|
|
[](https://coinbase.com/checkouts/9ef59f5479eec1d97d63382c9ebcb93a "Donate once-off to this project using BitCoin")
|
|
[](http://amzn.com/w/2F8TXKSNAFG4V "Buy an item on our wishlist for us")
|
|
|
|
<!-- /BADGES -->
|
|
|
|
|
|
<!-- DESCRIPTION/ -->
|
|
|
|
Determines if a buffer is comprised of text or binary
|
|
|
|
<!-- /DESCRIPTION -->
|
|
|
|
|
|
<!-- INSTALL/ -->
|
|
|
|
## Install
|
|
|
|
### [NPM](http://npmjs.org/)
|
|
- Use: `require('istextorbinary')`
|
|
- Install: `npm install --save istextorbinary`
|
|
|
|
<!-- /INSTALL -->
|
|
|
|
|
|
## Usage
|
|
|
|
``` javascript
|
|
// Sync
|
|
var result = require('istextorbinary').isTextSync(filename, buffer);
|
|
|
|
// Async
|
|
require('istextorbinary').isText(filename, buffer, function(err, result){
|
|
// ...
|
|
});
|
|
|
|
// You can supply text or buffer, or both text and buffer, the more provided, the more accurate the result
|
|
// isBinary, and isBinarySync methods also provided
|
|
```
|
|
|
|
|
|
<!-- HISTORY/ -->
|
|
|
|
## History
|
|
[Discover the change history by heading on over to the `HISTORY.md` file.](https://github.com/bevry/istextorbinary/blob/master/HISTORY.md#files)
|
|
|
|
<!-- /HISTORY -->
|
|
|
|
|
|
<!-- CONTRIBUTE/ -->
|
|
|
|
## Contribute
|
|
|
|
[Discover how you can contribute by heading on over to the `CONTRIBUTING.md` file.](https://github.com/bevry/istextorbinary/blob/master/CONTRIBUTING.md#files)
|
|
|
|
<!-- /CONTRIBUTE -->
|
|
|
|
|
|
<!-- BACKERS/ -->
|
|
|
|
## Backers
|
|
|
|
### Maintainers
|
|
|
|
These amazing people are maintaining this project:
|
|
|
|
- Benjamin Lupton <b@lupton.cc> (https://github.com/balupton)
|
|
|
|
### Sponsors
|
|
|
|
No sponsors yet! Will you be the first?
|
|
|
|
[](https://www.gratipay.com/bevry/ "Donate weekly to this project using Gratipay")
|
|
[](http://flattr.com/thing/344188/balupton-on-Flattr "Donate monthly to this project using Flattr")
|
|
[](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QB8GQPZAH84N6 "Donate once-off to this project using Paypal")
|
|
[](https://coinbase.com/checkouts/9ef59f5479eec1d97d63382c9ebcb93a "Donate once-off to this project using BitCoin")
|
|
[](http://amzn.com/w/2F8TXKSNAFG4V "Buy an item on our wishlist for us")
|
|
|
|
### Contributors
|
|
|
|
These amazing people have contributed code to this project:
|
|
|
|
- [Benjamin Lupton](https://github.com/balupton) <b@lupton.cc> — [view contributions](https://github.com/bevry/istextorbinary/commits?author=balupton)
|
|
- [shinnn](https://github.com/shinnn) — [view contributions](https://github.com/bevry/istextorbinary/commits?author=shinnn)
|
|
|
|
[Become a contributor!](https://github.com/bevry/istextorbinary/blob/master/CONTRIBUTING.md#files)
|
|
|
|
<!-- /BACKERS -->
|
|
|
|
|
|
<!-- LICENSE/ -->
|
|
|
|
## License
|
|
|
|
Licensed under the incredibly [permissive](http://en.wikipedia.org/wiki/Permissive_free_software_licence) [MIT license](http://creativecommons.org/licenses/MIT/)
|
|
|
|
Copyright © 2012+ Bevry Pty Ltd <us@bevry.me> (http://bevry.me)
|
|
<br/>Copyright © 2011 Benjamin Lupton <b@lupton.cc> (http://balupton.com)
|
|
|
|
<!-- /LICENSE -->
|
|
|
|
|