{"id":19974290,"url":"https://github.com/gbroques/zlib-git-nodejs","last_synced_at":"2026-05-11T07:05:52.255Z","repository":{"id":94020789,"uuid":"396063541","full_name":"gbroques/zlib-git-nodejs","owner":"gbroques","description":"Read, hash, and store git objects with Node JS.","archived":false,"fork":false,"pushed_at":"2021-08-14T19:40:07.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-12T09:42:24.016Z","etag":null,"topics":["git","git-internals","git-object-hash","node-js","nodejs","sha1","sha1-hash","zlib"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/gbroques.png","metadata":{"files":{"readme":"README.md","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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-08-14T16:23:27.000Z","updated_at":"2021-08-14T19:40:09.000Z","dependencies_parsed_at":"2023-03-13T17:08:17.641Z","dependency_job_id":null,"html_url":"https://github.com/gbroques/zlib-git-nodejs","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/gbroques%2Fzlib-git-nodejs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gbroques%2Fzlib-git-nodejs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gbroques%2Fzlib-git-nodejs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gbroques%2Fzlib-git-nodejs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gbroques","download_url":"https://codeload.github.com/gbroques/zlib-git-nodejs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241411427,"owners_count":19958746,"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":["git","git-internals","git-object-hash","node-js","nodejs","sha1","sha1-hash","zlib"],"created_at":"2024-11-13T03:14:32.860Z","updated_at":"2026-05-11T07:05:47.228Z","avatar_url":"https://github.com/gbroques.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# zlib-git-nodejs\nRead, hash, and store git objects, compressed with [zlib](https://en.wikipedia.org/wiki/Zlib), using [Node JS](https://nodejs.org/en/).\n\nMeant for educational purposes, and understanding [git internals](https://git-scm.com/book/en/v2/Git-Internals-Plumbing-and-Porcelain).\n\nCurrently *storing* git objects is not implemented.\n\n## Usage\n\n### cat-file\nNode.js equivalent to `git cat-file -p \u003cobject hash\u003e`.\n\n```bash\n$ git cat-file -p 9daeafb9864cf43055ae93beb0afd6c7d144bfa4 ↵\ntest\n```\n\nFor viewing the header containing object type, size in bytes, and null character separating header from content.\n```bash\n$ node cat-file.js 9daeafb9864cf43055ae93beb0afd6c7d144bfa4 ↵\nblob 5test\n```\n\n### console-dir\nUses `console.dir` to output contents from stdin to stdout.\n\n```bash\n$ node cat-file.js 9daeafb9864cf43055ae93beb0afd6c7d144bfa4 | node console-dir.js ↵\n'blob 5\\x00test\\n'\n```\n\nFor viewing hidden characters such as [null characters](https://en.wikipedia.org/wiki/Null_character) (`\\x00`) or new-line characters (`\\n`).\n\n### hash-object\nNode.js equivalent to `git hash-object --stdin`.\n\n```bash\n$ echo 'test' | git hash-object --stdin ↵\n9daeafb9864cf43055ae93beb0afd6c7d144bfa4\n```\n\nFor illustrative purposes, demonstrating the hash is the [SHA-1](https://en.wikipedia.org/wiki/SHA-1) of the object's full content, including header information.\n```bash\n$ node cat-file.js 9daeafb9864cf43055ae93beb0afd6c7d144bfa4 | node hash-object.js ↵\n9daeafb9864cf43055ae93beb0afd6c7d144bfa4\n```\n\n## Limitations\nCurrently works with blobs, commits, but *not* **trees**.\n\n## Articles\n\n* https://git-scm.com/book/en/v2/Git-Internals-Git-Objects\n* https://matthew-brett.github.io/curious-git/reading_git_objects.html\n* https://stackoverflow.com/questions/7625251/compression-and-decompression-of-data-using-zlib-in-nodejs\n* https://developpaper.com/front-end-ramble-git-internal-principle-git-object/\n* https://stackoverflow.com/questions/6984139/how-can-i-get-the-sha1-hash-of-a-string-in-node-js\n* https://codewords.recurse.com/issues/three/unpacking-git-packfiles\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgbroques%2Fzlib-git-nodejs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgbroques%2Fzlib-git-nodejs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgbroques%2Fzlib-git-nodejs/lists"}