{"id":20301688,"url":"https://github.com/stpettersens/node-magic-number","last_synced_at":"2026-03-15T07:36:55.618Z","repository":{"id":34301177,"uuid":"38209556","full_name":"stpettersens/node-magic-number","owner":"stpettersens","description":":seven: Node.js module to determine a file's type from its magic number.","archived":false,"fork":false,"pushed_at":"2017-08-29T14:10:20.000Z","size":49,"stargazers_count":8,"open_issues_count":2,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-23T10:03:01.935Z","etag":null,"topics":["library","magic","module","nodejs","number"],"latest_commit_sha":null,"homepage":"http://npmjs.com/package/magic-number","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/stpettersens.png","metadata":{"files":{"readme":"README.markdown","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-06-28T18:32:31.000Z","updated_at":"2023-04-11T04:56:51.000Z","dependencies_parsed_at":"2022-09-14T03:31:55.523Z","dependency_job_id":null,"html_url":"https://github.com/stpettersens/node-magic-number","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stpettersens%2Fnode-magic-number","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stpettersens%2Fnode-magic-number/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stpettersens%2Fnode-magic-number/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stpettersens%2Fnode-magic-number/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stpettersens","download_url":"https://codeload.github.com/stpettersens/node-magic-number/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248410206,"owners_count":21098772,"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":["library","magic","module","nodejs","number"],"created_at":"2024-11-14T16:27:12.236Z","updated_at":"2026-03-15T07:36:50.592Z","avatar_url":"https://github.com/stpettersens.png","language":"JavaScript","readme":"#### Magic-number\n\n[![Build Status](https://travis-ci.org/stpettersens/node-magic-number.svg?branch=master)](https://travis-ci.org/stpettersens/node-magic-number) [![npm version](https://badge.fury.io/js/magic-number.svg)](http://npmjs.org/package/magic-number) [![Development Dependency Status](https://david-dm.org/stpettersens/node-magic-number/dev-status.png?theme=shields.io)](https://david-dm.org/stpettersens/node-magic-number?type=dev) \n\nNode.js module to determine a file's type from its magic number.\n\nUse from JavaScript:\n\n```js\nvar magic = require('magic-number');\nmagic.detectFile('file.zip'); // ==\u003e 'application/zip'\nmagic.detectFile('file.7z');  // ==\u003e 'application/x-7z-compressed'\n```\n\nUse from [TypeScript](http://www.typescriptlang.org):\n\n```ts\n/// \u003crequire path=\"typings/magic-number.d.ts\" /\u003e\nimport magic = require('magic-number');\nmagic.detectFile('file.zip'); // ==\u003e 'application/zip'\nmagic.detectFile('file.7z');  // ==\u003e 'application/x-7z-compressed'\n```\n\nMethods:\n\n**magic.detectFile(file: string): string**\n\nParameter *file* is path string for the file to test.\n\n**magic.detectType(data: any): string**\n\nParameter *data* is binary data for the file to test.\n\nReturns a MIME type for the tested file, 'unknown' if file type is not detected or\nmessage when file doesn't exist.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstpettersens%2Fnode-magic-number","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstpettersens%2Fnode-magic-number","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstpettersens%2Fnode-magic-number/lists"}