{"id":38179606,"url":"https://github.com/earentir/identifybin","last_synced_at":"2026-01-16T23:46:25.453Z","repository":{"id":162589515,"uuid":"637112459","full_name":"earentir/identifybin","owner":"earentir","description":null,"archived":false,"fork":false,"pushed_at":"2024-02-24T18:31:00.000Z","size":21,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-02-24T19:28:48.130Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/earentir.png","metadata":{"files":{"readme":"README.md","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,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-05-06T14:46:09.000Z","updated_at":"2024-02-24T19:28:49.519Z","dependencies_parsed_at":"2024-01-20T14:47:19.489Z","dependency_job_id":null,"html_url":"https://github.com/earentir/identifybin","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/earentir/identifybin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/earentir%2Fidentifybin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/earentir%2Fidentifybin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/earentir%2Fidentifybin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/earentir%2Fidentifybin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/earentir","download_url":"https://codeload.github.com/earentir/identifybin/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/earentir%2Fidentifybin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28488173,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T22:54:02.790Z","status":"ssl_error","status_checked_at":"2026-01-16T22:50:10.344Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":"2026-01-16T23:46:23.402Z","updated_at":"2026-01-16T23:46:25.448Z","avatar_url":"https://github.com/earentir.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# identifybin\n\nA small package used to identify the OS and Architecture of a binary from a few bytes of a file, made as a support package for github.com/earentir/gitearelease\n\n\n## Usage/Examples\n\n### Check version of current and compare to latest release\n```go\nimport (\n\t\"fmt\"\n\n\t\"github.com/earentir/identifybin\"\n)\n\nfunc checkVersion() {\n\t// Get OS of attachment binary\n\turl := \"https://github.com/earentir/subscan/releases/download/v0.1.5/subscan\"\n\tbyteCount := int64(256) // number of bytes to download\n\n\tbytes, err := identifybin.DownloadFirstNBytes(url, byteCount)\n\tif err != nil {\n\tfmt.Println(\"Error:\", err)\n\tbreak\n\t}\n\n\tbinType, err := identifybin.DetectOSAndArch(bytes)\n\tif err != nil {\n\tfmt.Println(\"Error:\", err)\n\tbreak\n\t}\n\n\tfmt.Printf(\"%s %s %s\\n\", binType.OperatingSystem, binType.Arch, binType.Endianess)\n}\n```\n\n## Func Reference\n\n### DetectOSAndArch\n```go\nfunc DetectOSAndArch(input interface{}) (BinaryType, error)\n```\n| Parameter | Type     | Description                |\n| :-------- | :------- | :------------------------- |\n| `input` | `string` or `[]byte`  | **Required**  |\n\nDetectOSAndArch will either take a byte array or a string and then detect the OS and Architecture of that file\n\n\n### DownloadFirstNBytes\n```go\nfunc DownloadFirstNBytes(url string, byteCount int64) ([]byte, error)\n```\n| Parameter | Type     | Description                |\n| :-------- | :------- | :------------------------- |\n| `url` | `string` | **Required**  |\n| `byteCount` | `int64` | **Required**  |\n\nDownloadFirstNBytes downloads the first N bytes of a file from a URL.\n\n## Dependancies \u0026 Documentation\n[![Go Mod](https://img.shields.io/github/go-mod/go-version/earentir/identifybin)]()\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/earentir/identifybin.svg)](https://pkg.go.dev/github.com/earentir/identifybin) \n\n[![Dependancies](https://img.shields.io/librariesio/github/earentir/identifybin)]()\n\n## Authors\n- [@earentir](https://www.github.com/earentir)\n\n\n## License\nI will always follow the Linux Kernel License as primary, if you require any other OPEN license please let me know and I will try to accomodate it.\n\n[![License](https://img.shields.io/github/license/earentir/identifybin)](https://opensource.org/license/gpl-2-0)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fearentir%2Fidentifybin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fearentir%2Fidentifybin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fearentir%2Fidentifybin/lists"}