{"id":28684910,"url":"https://github.com/node-modules/buffer-type","last_synced_at":"2025-06-14T03:07:48.203Z","repository":{"id":10015115,"uuid":"12053091","full_name":"node-modules/buffer-type","owner":"node-modules","description":"Detect content-type from Buffer data.","archived":false,"fork":false,"pushed_at":"2018-06-28T12:15:40.000Z","size":3726,"stargazers_count":14,"open_issues_count":1,"forks_count":2,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-06-02T18:28:34.669Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/node-modules.png","metadata":{"files":{"readme":"README.md","changelog":"History.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-08-12T10:07:02.000Z","updated_at":"2024-02-26T07:35:23.000Z","dependencies_parsed_at":"2022-09-01T22:23:05.243Z","dependency_job_id":null,"html_url":"https://github.com/node-modules/buffer-type","commit_stats":null,"previous_names":["fengmk2/buffer-type","node-modules/buffer-type","alibaba-archive/buffer-type"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/node-modules/buffer-type","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-modules%2Fbuffer-type","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-modules%2Fbuffer-type/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-modules%2Fbuffer-type/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-modules%2Fbuffer-type/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/node-modules","download_url":"https://codeload.github.com/node-modules/buffer-type/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/node-modules%2Fbuffer-type/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259752078,"owners_count":22905972,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-14T03:07:40.782Z","updated_at":"2025-06-14T03:07:48.195Z","avatar_url":"https://github.com/node-modules.png","language":"JavaScript","readme":"buffer-type\n=======\n\n[![NPM version][npm-image]][npm-url]\n[![NPM quality][quality-image]][quality-url]\n[![build status][travis-image]][travis-url]\n[![Test coverage][codecov-image]][codecov-url]\n[![David deps][david-image]][david-url]\n[![Known Vulnerabilities][snyk-image]][snyk-url]\n[![NPM download][download-image]][download-url]\n\n[npm-image]: https://img.shields.io/npm/v/buffer-type.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/buffer-type\n[quality-image]: http://npm.packagequality.com/shield/buffer-type.svg?style=flat-square\n[quality-url]: http://packagequality.com/#?package=buffer-type\n[travis-image]: https://img.shields.io/travis/node-modules/buffer-type.svg?style=flat-square\n[travis-url]: https://travis-ci.org/node-modules/buffer-type\n[codecov-image]: https://img.shields.io/codecov/c/github/node-modules/buffer-type.svg?style=flat-square\n[codecov-url]: https://codecov.io/gh/node-modules/buffer-type\n[david-image]: https://img.shields.io/david/node-modules/buffer-type.svg?style=flat-square\n[david-url]: https://david-dm.org/node-modules/buffer-type\n[snyk-image]: https://snyk.io/test/npm/buffer-type/badge.svg?style=flat-square\n[snyk-url]: https://snyk.io/test/npm/buffer-type\n[download-image]: https://img.shields.io/npm/dm/buffer-type.svg?style=flat-square\n[download-url]: https://npmjs.org/package/buffer-type\n\nDetect content-type from Buffer data.\n\n## Install\n\n```bash\n$ npm install buffer-type\n```\n\n## Usage\n\n```js\nconst bt = require('buffer-type');\nconst fs = require('fs');\n\nconst info = bt(fs.readFileSync(__dirname + '/logo.png'));\nconsole.log(info);\n// {\n//   type: 'image/png',\n//    extension: '.png',\n//    width: 618,\n//    height: 96,\n//    bit: 8, // bit depth\n//    color: 6,\n//    compression: 0,\n//    filter: 0,\n//    interlace: 0\n// }\n```\n\n## References\n\n* http://www.onicos.com/staff/iz/formats/\n* http://www.fastgraph.com/help/image_file_header_formats.html\n* http://en.wikipedia.org/wiki/Portable_Network_Graphics\n* http://en.wikipedia.org/wiki/Image_file_format\n\n## TODO\n\n* Image\n  * [√] .png\n  * [√] .jpg\n  * [√] .bmp\n  * [√] .gif\n  * [√] .webp\n  * [ ] .svg\n  * [ ] .tif\n  * [ ] .psd\n* Tar\n  * [ ] .tar\n  * [ ] .gzip\n  * [ ] .zip\n  * [ ] .rar\n* PE file\n  * [ ] .exe\n  * [ ] .msi\n  * [ ] .apk\n  * [ ] .ipa\n* Text\n  * [ ] .xml\n  * [ ] .html\n  * [ ] .json\n* Media\n  * [ ] .mp3\n  * [ ] .mp4\n  * [ ] .avi\n\n## License\n\n[MIT](LICENSE.txt)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnode-modules%2Fbuffer-type","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnode-modules%2Fbuffer-type","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnode-modules%2Fbuffer-type/lists"}