Skip to content

Commit

Permalink
update docs for dumping
Browse files Browse the repository at this point in the history
  • Loading branch information
tybug authored Dec 28, 2021
1 parent 938083a commit 39a1b88
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,22 @@ Note that if you use the `/get_replay` endpoint to retrieve a replay, you must d

### Dumping

To dump a replay to a filepath:
Existing `Replay` objects can be "dumped" back to a `.osr` file:

```python
from osrparse import dump_replay_file

# ...some parsing code here
dump_replay_file(replay, "path/to/osr.osr")
replay.dump("path/to/osr.osr")
# or to an opened file object
with open("path/to/osr.osr") as f:
replay.dump(f)
```

To dump a replay into a variable:
You can also edit osr files by parsing a replay, editing an attribute, and dumping it back to its file:

```python
from osrparse import dump_replay

# ...some parsing code here
osr_content = dump_replay(replay)
replay = parse_replay_file("path/to/osr.osr")
replay.player_name = "fake username"
replay.dump(""path/to/osr.osr")
```

### Attributes
Expand Down

0 comments on commit 39a1b88

Please sign in to comment.