https://github.com/pykit3/k3cat
Just like nix command cat or tail, it continuously scan a file line by line.
https://github.com/pykit3/k3cat
python
Last synced: 4 months ago
JSON representation
Just like nix command cat or tail, it continuously scan a file line by line.
- Host: GitHub
- URL: https://github.com/pykit3/k3cat
- Owner: pykit3
- License: mit
- Created: 2021-08-18T02:56:42.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2025-08-28T12:35:59.000Z (9 months ago)
- Last Synced: 2025-09-28T08:25:33.552Z (8 months ago)
- Topics: python
- Language: Python
- Homepage: https://blog.openacid.com
- Size: 38.1 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# k3cat
[](https://github.com/pykit3/k3cat/actions/workflows/python-package.yml)
[](https://k3cat.readthedocs.io/en/stable/?badge=stable)
[](https://pypi.org/project/k3cat)
Just like nix command cat or tail, it continuously scan a file line by line.
k3cat is a component of [pykit3] project: a python3 toolkit set.
Just like nix command cat or tail, it continuously scan a file line by line.
It provides with two way for user to handle lines: as a generator or specifying
a handler function.
It also remembers the offset of the last scanning in a file in `/tmp/`.
If a file does not change(inode number does not change), it scans from the last
offset, or it scan from the first byte.
# Install
```
pip install k3cat
```
# Synopsis
```python
import sys
import k3cat
fn = sys.argv[1]
for x in k3cat.Cat(fn, strip=True).iterate(timeout=0):
print(x)
```
# Author
Zhang Yanpo (张炎泼)
# Copyright and License
The MIT License (MIT)
Copyright (c) 2015 Zhang Yanpo (张炎泼)
[pykit3]: https://github.com/pykit3