Skip to content

Write

rustac.write async

write(
    href: str,
    value: dict[str, Any] | Sequence[dict[str, Any]],
    *,
    format: str | None = None,
    store: AnyObjectStore | None = None,
) -> dict[str, str] | None

Writes STAC to a href.

Parameters:

  • href (str) –

    The href to write to

  • value (dict[str, Any] | Sequence[dict[str, Any]]) –

    The value to write. This can be a STAC dictionary or a list of items.

  • format (str | None, default: None ) –

    The output format to write. If not provided, will be inferred from the href's extension.

  • store (AnyObjectStore | None, default: None ) –

    The object store to use for writing.

Returns:

  • dict[str, str] | None

    The result of putting data into an object store, e.g. the e_tag and the version. None is returned if the file was written locally.

Examples:

>>> with open("items.json") as f:
...     items = json.load(f)
>>> await rustac.write("items.parquet", items)