Local
File Change Stream
LocalFileChangeStream is a source primitive that can be used to listen to file change events for a file path. To create a LocalFileChangeStream provide the
Arg | Description |
---|---|
file_path | file path to listen to changes in |
event_types | List of event types to subscribe to. Defaults to: [FileChangeStreamEventType.CREATED] |
from buildflow.io.local import LocalFileChangeStream
from buildflow.types.local import FileChangeStreamEventType, LocalFileChangeEvent
source = LocalFileChangeStream(file_path="./dir_to_listen/", event_types=[FileChangeStreamEventType.CREATED])
@app.consumer(source=source, sink=...)
def process(elem: LocalFileChangeEvent):
...
Types
The LocalFileChangeStream source always returns a LocalFileChangeEvent
object. This object contains the following fields:
Field | Description |
---|---|
event_type | The buildflow.types.local.FileChangeStreamEventType event type |
metadata | Any metadata that was associated with the file change event. This is a dictionary of strings. |
blob | The raw contents of the file. This is lazily fetched. |