New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

istextorbinary

Package Overview
Dependencies
Maintainers
4
Versions
106
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

istextorbinary - npm Package Compare versions

Comparing version 2.4.0 to 2.4.1

4

HISTORY.md
# History
## v2.4.1 2019 January 21
- README now elaborates on the operation of this package
## v2.4.0 2019 January 20

@@ -4,0 +8,0 @@

4

package.json
{
"title": "Is Text or Binary?",
"name": "istextorbinary",
"version": "2.4.0",
"description": "Determines if a buffer is comprised of text or binary",
"version": "2.4.1",
"description": "Determine if a filename and/or buffer is a text file or binary file. Smarter detection than the other solutions.",
"homepage": "https://github.com/bevry/istextorbinary",

@@ -7,0 +7,0 @@ "license": "MIT",

@@ -32,3 +32,3 @@ <!-- TITLE/ -->

Determines if a buffer is comprised of text or binary
Determine if a filename and/or buffer is a text file or binary file. Smarter detection than the other solutions.

@@ -38,2 +38,19 @@ <!-- /DESCRIPTION -->

Determination works like so:
1. If filename is available, check if its extension is a [text extension](https://github.com/bevry/textextensions) or if it is a [binary extension](https://github.com/bevry/binaryextensions), this is near instant.
2. If no filename was provided, or the extension check was indeterminate, then check the buffer.
The buffer check (with the default options) will check 24 bytes at the start, middle, and end of the buffer. History has shown that checking all three locations is mandatory for accuracy, and that anything less is not accurate. This technique offers superior performance while still offering superior accuracy. Alternatives generally just do 1000 bytes at the start, which is slower, and inaccurate.
One cannot just do the buffer check alone because UTF16 characters are indistinguishable from binary which would return an inaccurate result, hence why the combination is necessary for accuracy, with performance for known extensions a side-effect.
As such, this library's combination of text check (if filename is provided), then buffer check (if buffer is provided), offers superior performance and accuracy to alternatives.
Ever since 2012, this module's superior accuracy and performance has been essential to the operation of [DocPad](https://docpad.org) and its other dependents.
## Usage
[Complete API Documentation.](http://master.istextorbinary.bevry.surge.sh/docs/)
<!-- INSTALL/ -->

@@ -81,6 +98,2 @@

## Usage
[API Documentation.](http://master.istextorbinary.bevry.surge.sh/docs/)
<!-- HISTORY/ -->

@@ -87,0 +100,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc