{"id":24557841,"url":"https://github.com/timclicks/bin2src","last_synced_at":"2025-10-08T11:15:03.878Z","repository":{"id":138082453,"uuid":"177261570","full_name":"timClicks/bin2src","owner":"timClicks","description":"Convert a stream of bytes into source code","archived":false,"fork":false,"pushed_at":"2019-04-10T21:15:01.000Z","size":22,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-29T03:00:00.991Z","etag":null,"topics":["command-line","rust","utility"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/timClicks.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,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2019-03-23T08:04:30.000Z","updated_at":"2023-04-26T00:15:45.000Z","dependencies_parsed_at":"2024-05-16T10:01:10.831Z","dependency_job_id":null,"html_url":"https://github.com/timClicks/bin2src","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/timClicks/bin2src","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timClicks%2Fbin2src","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timClicks%2Fbin2src/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timClicks%2Fbin2src/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timClicks%2Fbin2src/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/timClicks","download_url":"https://codeload.github.com/timClicks/bin2src/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timClicks%2Fbin2src/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278931697,"owners_count":26070800,"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","status":"online","status_checked_at":"2025-10-08T02:00:06.501Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["command-line","rust","utility"],"created_at":"2025-01-23T05:29:41.845Z","updated_at":"2025-10-08T11:15:03.874Z","avatar_url":"https://github.com/timClicks.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"src2bin\n=======\n\n[![asciicast](https://asciinema.org/a/236012.svg)](https://asciinema.org/a/236012)\n\n\nabout\n-----\n\n`bin2src` takes an input stream of bytes and converts\nthat into source code. That source code can then be \neasily embedded in future projects.\n\n\nusage\n-----\n\nRead bytes from STDIN and write them to STDOUT:\n\n    $ echo \"hello\" | bin2src\n    \\x68\\x65\\x6c\\x6c\\x6f\\x0a\n\nNote that there is no need to convert your input bytes to a plain text encoding:\n\n    $ head -c 10 /dev/urandom | bin2src \n    \\x30\\xc7\\x18\\x67\\x5b\\xc3\\x7b\\x7d\\x12\\xcd\n\nThe primary purpose of `bin2src` is to facilitate embedding binary blobs into software source code.\nTo specify an output format, use the `-f` option (\"f\" for format):\n\n    $ head -c 10 /dev/urandom | bin2src -f python\n    DATA = \"\"\"\\x22\\x82\\x2d\\xd4\\xb8\\x8c\\x36\\xb4\\x35\\x21\"\"\"\n\nIf you would like to change the variable name, use the `-a` option (\"a\" is a common mathematical variable):\n\n    $ head -c 10 /dev/urandom | bin2src -f python -a RAND_BYTES\n    RAND_BYTES = \"\"\"\\xf5\\xde\\x5e\\xdc\\x66\\xeb\\x89\\x24\\x13\\xd5\"\"\"\n\nOther options are available. See the full list by running `bin2src --help`. \n\nsupported output formats\n------------------------\n\n- plaintext (default)\n- go\n- rust\n- python\n\nbuilding\n--------\n\nThe easiest route is via `git` and `cargo`:\n\n    $ git clone https://git.nzoss.org.nz/tim-mcnamara/bin2src\n    $ cd bin2src\n    $ cargo build\n\n`bin2src` will now be available within the `./target/debug` directory:\n\n    $ echo Hello | ./target/debug/bin2src -f rust\n    const DATA: \u0026[u8] = b\"\\x48\\x65\\x6c\\x6c\\x6f\\x0a\";\n\n\ncontributing\n------------\n\n**Contributions welcome!**\n\nAdding support for a new language is very easy. It should take no \nmore than adding 10 lines of code. \n\nIf you're not comfortable writing software, but still have an idea to\nextend the project -- that's fine too. Please file an issue with the language that you would like\nsupported and/or any other features that you are \ninterested in.\n\n\nlegal\n-----\n\n## copyright\n\nBIN2SRC is open source software. You're entitled to copy, store and redistribute \nBIN2SRC as provided under the terms of the [Blue Oak Model License][].\n\n[Blue Oak Model License]: https://blueoakcouncil.org/license/1.0.0\n\n```markdown\n# Blue Oak Model License\n\nVersion 1.0.0\n\n## Purpose\n\nThis license gives everyone as much permission to work with\nthis software as possible, while protecting contributors\nfrom liability.\n\n## Acceptance\n\nIn order to receive this license, you must agree to its\nrules.  The rules of this license are both obligations\nunder that agreement and conditions to your license.\nYou must not do anything with this software that triggers\na rule that you cannot or will not follow.\n\n## Copyright\n\nEach contributor licenses you to do everything with this\nsoftware that would otherwise infringe that contributor's\ncopyright in it.\n\n## Notices\n\nYou must ensure that everyone who gets a copy of\nany part of this software from you, with or without\nchanges, also gets the text of this license or a link to\n\u003chttps://blueoakcouncil.org/license/1.0.0\u003e.\n\n## Excuse\n\nIf anyone notifies you in writing that you have not\ncomplied with [Notices](#notices), you can keep your\nlicense by taking all practical steps to comply within 30\ndays after the notice.  If you do not do so, your license\nends immediately.\n\n## Patent\n\nEach contributor licenses you to do everything with this\nsoftware that would otherwise infringe any patent claims\nthey can license or become able to license.\n\n## Reliability\n\nNo contributor can revoke this license.\n\n## No Liability\n\n***As far as the law allows, this software comes as is,\nwithout any warranty or condition, and no contributor\nwill be liable to anyone for any damages related to this\nsoftware or this license, under any kind of legal claim.***\n```\n\n## trade mark\n\nBIN2SRC is a trade mark of Tim McNamara.\n\n\n## consumer protection\n\nIf you're using BIN2SRC for personal reasons, you have rights under New \nZealand's Consumer Guarantees Act 1993. Be aware though that this \nsoftware is software that you've downloaded from the Internet for \nfree, so please use use your own diligence.\n\n\n## jurisdiction\n\nIn case of any disputes, the laws of New Zealand apply.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimclicks%2Fbin2src","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimclicks%2Fbin2src","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimclicks%2Fbin2src/lists"}