{"id":18041649,"url":"https://github.com/katyo/node-mgc","last_synced_at":"2026-01-16T04:04:08.417Z","repository":{"id":4733939,"uuid":"5882878","full_name":"katyo/node-mgc","owner":"katyo","description":"Node libmagic addon (detects mime info by inspecting node buffer's data).","archived":false,"fork":false,"pushed_at":"2012-09-21T06:33:50.000Z","size":329,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-05T02:27:50.044Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/katyo.png","metadata":{"files":{"readme":"README.org","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-09-20T06:57:52.000Z","updated_at":"2013-12-14T01:11:16.000Z","dependencies_parsed_at":"2022-08-06T17:31:06.330Z","dependency_job_id":null,"html_url":"https://github.com/katyo/node-mgc","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/katyo/node-mgc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katyo%2Fnode-mgc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katyo%2Fnode-mgc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katyo%2Fnode-mgc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katyo%2Fnode-mgc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/katyo","download_url":"https://codeload.github.com/katyo/node-mgc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/katyo%2Fnode-mgc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28477206,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T03:13:13.607Z","status":"ssl_error","status_checked_at":"2026-01-16T03:11:47.863Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":"2024-10-30T16:11:16.809Z","updated_at":"2026-01-16T04:04:08.396Z","avatar_url":"https://github.com/katyo.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"* TODO Overview\n\n  This addon adds to node functionality of libmagic and `file` util.\n\n  Unlike to https://github.com/mscdex/mmmagic it:\n\n  + Uses native installed libmagic\n  + Support strings, node buffers and streams only\n  + Operate absolutely thread-safe (although libmagic isn't thread-safe)\n\n* TODO Usage\n  : var MGC = require('mgc'); /* require module */\n  : var mgc = new MGC(flags); /* create new instance with flags (optional) */\n\n** Loading\n\n*** Default database\n    : mgc.load(function(err){ /* load default .mgc databases */\n    :   if(err) throw err;\n    :   /* now mgc is ready for use */\n    : });\n\n*** Own .mgc databases\n    : mgc.load('/usr/share/file/magic.mgc:/home/user/magic.mgc',\n    : function(err){ /* load .mgc databases */\n    :   if(err) throw err;\n    :   /* now mgc is ready for use */\n    : });\n\n** Detecting\n\n*** String and Buffer\n    : mgc.data(buf_or_str, function(err, desc){ /* gets description of data */\n    :   if(err) throw err;\n    :   console.log(desc);\n    : });\n\n*** Readable Stream\n    : var FS = require('fs');\n    : var stm = FS.createReadStream('path/to/file');\n    : mgc.wrap(stm);\n    : stm.on('magic', function(err, desc){ /* gets description of data */\n    :   if(err) throw err;\n    :   console.log(desc);\n    : });\n\n* TODO Specs\n\n** Flags\n   \n   Flags is a string of names, like this:\n   \n   + *debug, d* — turn on debugging\n   + *type, t* — return the MIME type\n   + *enc, c* — return the MIME encoding\n   + *mime, m* — return the MIME type and encoding (same as t+c)\n   + *all, a* — return all matches\n   + *error, e* — handle ENOENT etc as real errors\n\n   Flags may be combined in any order and separated by +|,:\n\n** Wrap\n\n   You can pass a minimal (for detecting) content length in bytes as second argument to *wrap* call.\n   By default it equals to 16 Kbytes.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkatyo%2Fnode-mgc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkatyo%2Fnode-mgc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkatyo%2Fnode-mgc/lists"}