httk.core.saving¶
Dispatch local file writers and format serializers.
Functions¶
|
Return whether |
|
Save |
Module Contents¶
- httk.core.saving.has_writer_for(name)¶
Return whether
namematches a registered writer key.
- httk.core.saving.save(obj, destination, *, format=None, **kwargs)¶
Save
objto a local destination selected by its name orformathint.The writer registry selects by extension first and exact basename second, case-insensitively after stripping one recognized compression suffix, unless
formatselects a registered writer directly. The format-serializer registry converts non-neutral objects before writing, and a recognized compression suffix wraps the destination transparently.Filename output replaces its destination only after writing and closing successfully, so lazy inputs may safely be saved over their source file. Existing symlinks are followed and permission bits retained; other hard links retain the old data. This is not a crash-durability guarantee.
- Parameters:
obj (Any) – Object or neutral payload to serialize and write.
destination (str | os.PathLike[str]) – Local filename or path to write.
format (str | None) – Optional registered format name that selects the writer.
**kwargs (Any) – Additional options passed to the selected writer.
- Raises:
ValueError – If the destination or format has no writer, no serializer exists, or the destination is a URL.