git-packed-ref-parse
Version:
streaming git packed-ref parser
42 lines (27 loc) • 753 B
Markdown
ref file streams into javascript objects.
```javascript
// after git gc in a git repo
var fs = require('fs')
, parse = require('git-packed-ref-parse')
fs.createReadStream('.git/packed-refs')
.pipe(parse())
.on('data', console.log)
```
create a parse stream. when piped to, it will set
the encoding of the source stream to `utf8`.
the parse stream will emit data events for each
ref contained in the `packed-ref` file.
they take this form:
```javascript
{ "hash": "40 character git hash"
, "name": "ref name"
, "commit": null | "40 character git hash" }
```
`commit` will usually be `null`, except for annotated
`tag` references.
MIT
parse packed-