aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--snekbox/snekio.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/snekbox/snekio.py b/snekbox/snekio.py
index 45ebc61..821f057 100644
--- a/snekbox/snekio.py
+++ b/snekbox/snekio.py
@@ -80,12 +80,13 @@ class FileAttachment:
"""Size of the attachment."""
return len(self.content)
- def save_to(self, directory: Path | str) -> None:
- """Write the attachment to a file in `directory`."""
+ def save_to(self, directory: Path | str) -> Path:
+ """Write the attachment to a file in `directory`. Return a Path of the file."""
file = Path(directory, self.path)
# Create directories if they don't exist
file.parent.mkdir(parents=True, exist_ok=True)
file.write_bytes(self.content)
+ return file
@cached_property
def as_dict(self) -> dict[str, str | int]: