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

ArgDescription
file_pathfile path to listen to changes in
event_typesList 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:

FieldDescription
event_typeThe buildflow.types.local.FileChangeStreamEventType event type
metadataAny metadata that was associated with the file change event. This is a dictionary of strings.
blobThe raw contents of the file. This is lazily fetched.