https://github.com/delta62/editcount
Break Git commits into object streams
https://github.com/delta62/editcount
commits git
Last synced: 3 months ago
JSON representation
Break Git commits into object streams
- Host: GitHub
- URL: https://github.com/delta62/editcount
- Owner: delta62
- Created: 2019-02-16T18:19:45.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-03-19T02:56:30.000Z (over 7 years ago)
- Last Synced: 2025-09-17T16:52:37.299Z (10 months ago)
- Topics: commits, git
- Language: TypeScript
- Size: 200 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://circleci.com/gh/delta62/editcount)
# editcount
Break git commits into a stream of metadata objects, like this:
``` javascript
{
hash: "8a6b02108fc1ff9feb30a6c0405fca9600f9a4a6",
authorName: "Sam Noedel",
authorEmail: "sam.noedel@example.com",
timestamp: 123456789,
filename: "test.ts",
isCreated: true,
isDeleted: false,
isRename: false,
additions: 42,
deletions: 0
}
```
You can either access the data via a node `Readable` stream, or from an [rxjs observable](https://rxjs.dev).
If you want to invoke the library from the command line, check out [@noedel/commit-stats](https://github.com/delta62/commit-stats).
## Usage
```
yarn add @noedel/editcount
```
:warning: Always validate the options of this library! It is invoking the `git` command via `child_process.spawn`,
so you should be absolutely certain the inputs are safe to run. :warning:
With an rxjs observable:
``` javascript
import { edits } from '@noedel/editcount'
// or import edits from '@noedel/editcount'
editStream({
from '8a6b02108fc1ff9feb30a6c0405fca9600f9a4a6',
to: '92e5030b918cc2a303de4f5056cde4506beb6eba',
cwd: '/home/person/repo'
}).subscribe(
console.log.bind(console),
console.error.bind(console)
)
```
With a node `Readable` stream:
``` javascript
import { editStream } from '@noedel/editcount'
let stream = editStream({
from '8a6b02108fc1ff9feb30a6c0405fca9600f9a4a6',
to: '92e5030b918cc2a303de4f5056cde4506beb6eba',
cwd: '/home/person/repo'
})
stream.on('data', console.log.bind(console))
stream.on('error', console.error.bind(console))
```
## License
MIT