file-type
Advanced tools
Comparing version 2.12.0 to 3.0.0
{ | ||
"name": "file-type", | ||
"version": "2.12.0", | ||
"version": "3.0.0", | ||
"description": "Detect the file type of a Buffer/Uint8Array", | ||
@@ -12,3 +12,2 @@ "license": "MIT", | ||
}, | ||
"bin": "cli.js", | ||
"engines": { | ||
@@ -21,8 +20,5 @@ "node": ">=0.10.0" | ||
"files": [ | ||
"index.js", | ||
"cli.js" | ||
"index.js" | ||
], | ||
"keywords": [ | ||
"cli-app", | ||
"cli", | ||
"mime", | ||
@@ -93,10 +89,7 @@ "file", | ||
], | ||
"dependencies": { | ||
"meow": "^3.3.0", | ||
"read-chunk": "^1.0.1" | ||
}, | ||
"devDependencies": { | ||
"ava": "*", | ||
"read-chunk": "^1.0.1", | ||
"xo": "*" | ||
} | ||
} |
@@ -20,5 +20,5 @@ # file-type [![Build Status](https://travis-ci.org/sindresorhus/file-type.svg?branch=master)](https://travis-ci.org/sindresorhus/file-type) | ||
```js | ||
var readChunk = require('read-chunk'); // npm install read-chunk | ||
var fileType = require('file-type'); | ||
var buffer = readChunk.sync('unicorn.png', 0, 262); | ||
const readChunk = require('read-chunk'); // npm install read-chunk | ||
const fileType = require('file-type'); | ||
const buffer = readChunk.sync('unicorn.png', 0, 262); | ||
@@ -32,8 +32,8 @@ fileType(buffer); | ||
```js | ||
var http = require('http'); | ||
var fileType = require('file-type'); | ||
var url = 'http://assets-cdn.github.com/images/spinners/octocat-spinner-32.gif'; | ||
const http = require('http'); | ||
const fileType = require('file-type'); | ||
const url = 'http://assets-cdn.github.com/images/spinners/octocat-spinner-32.gif'; | ||
http.get(url, function (res) { | ||
res.once('data', function (chunk) { | ||
http.get(url, res => { | ||
res.once('data', chunk => { | ||
res.destroy(); | ||
@@ -49,7 +49,7 @@ console.log(fileType(chunk)); | ||
```js | ||
var xhr = new XMLHttpRequest(); | ||
const xhr = new XMLHttpRequest(); | ||
xhr.open('GET', 'unicorn.png'); | ||
xhr.responseType = 'arraybuffer'; | ||
xhr.onload = function () { | ||
xhr.onload = () => { | ||
fileType(new Uint8Array(this.response)); | ||
@@ -79,21 +79,2 @@ //=> {ext: 'png', mime: 'image/png'} | ||
## CLI | ||
``` | ||
$ npm install --global file-type | ||
``` | ||
``` | ||
$ file-type --help | ||
Usage | ||
file-type <filename> | ||
cat <filename> | file-type | ||
Example | ||
cat unicorn.png | file-type | ||
png | ||
``` | ||
## Supported file types | ||
@@ -152,4 +133,9 @@ | ||
## Related | ||
- [file-type-cli](https://github.com/sindresorhus/file-type-cli) - CLI for this module | ||
## License | ||
MIT © [Sindre Sorhus](http://sindresorhus.com) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
0
13865
3
4
283
137
- Removedmeow@^3.3.0
- Removedread-chunk@^1.0.1
- Removedarray-find-index@1.0.2(transitive)
- Removedcamelcase@2.1.1(transitive)
- Removedcamelcase-keys@2.1.0(transitive)
- Removedcurrently-unhandled@0.4.1(transitive)
- Removeddecamelize@1.2.0(transitive)
- Removederror-ex@1.3.2(transitive)
- Removedfind-up@1.1.2(transitive)
- Removedfunction-bind@1.1.2(transitive)
- Removedget-stdin@4.0.1(transitive)
- Removedgraceful-fs@4.2.11(transitive)
- Removedhasown@2.0.2(transitive)
- Removedhosted-git-info@2.8.9(transitive)
- Removedindent-string@2.1.0(transitive)
- Removedis-arrayish@0.2.1(transitive)
- Removedis-core-module@2.15.1(transitive)
- Removedis-finite@1.1.0(transitive)
- Removedis-utf8@0.2.1(transitive)
- Removedload-json-file@1.1.0(transitive)
- Removedloud-rejection@1.6.0(transitive)
- Removedmap-obj@1.0.1(transitive)
- Removedmeow@3.7.0(transitive)
- Removedminimist@1.2.8(transitive)
- Removednormalize-package-data@2.5.0(transitive)
- Removedobject-assign@4.1.1(transitive)
- Removedparse-json@2.2.0(transitive)
- Removedpath-exists@2.1.0(transitive)
- Removedpath-parse@1.0.7(transitive)
- Removedpath-type@1.1.0(transitive)
- Removedpify@2.3.0(transitive)
- Removedpinkie@2.0.4(transitive)
- Removedpinkie-promise@2.0.1(transitive)
- Removedread-chunk@1.0.1(transitive)
- Removedread-pkg@1.1.0(transitive)
- Removedread-pkg-up@1.0.1(transitive)
- Removedredent@1.0.0(transitive)
- Removedrepeating@2.0.1(transitive)
- Removedresolve@1.22.8(transitive)
- Removedsemver@5.7.2(transitive)
- Removedsignal-exit@3.0.7(transitive)
- Removedspdx-correct@3.2.0(transitive)
- Removedspdx-exceptions@2.5.0(transitive)
- Removedspdx-expression-parse@3.0.1(transitive)
- Removedspdx-license-ids@3.0.20(transitive)
- Removedstrip-bom@2.0.0(transitive)
- Removedstrip-indent@1.0.1(transitive)
- Removedsupports-preserve-symlinks-flag@1.0.0(transitive)
- Removedtrim-newlines@1.0.0(transitive)
- Removedvalidate-npm-package-license@3.0.4(transitive)