davidmoten / davidmoten/rxjava-file

Existing lines are not emitted until the file is updated

Open
#10 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
85
Forks
18
PR merge metrics
No merged PRs in 30d

Description

The existing lines are emitted only when the file changes. This is not like tail(1) which dumps directly the current content.

Is there a way to achieve this or is there a missing flag?

Currently, I worked around with:

```
FileObservable.tailer()
.file(file)
.tailText()
.startWith(Observable.defer(() -> {
try {
return Observable.from(Files.readAllLines(Paths.get(file)));
} catch (IOException e) {
return Observable.error(e);
}
})
```

(Note: I defer in order to be sure that I do not miss lines)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.