-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Description
Hi! I'm currently using json-stream to parse a funky file that has a JSON header with binary data afterwards. The library handles such files without issues, but I would like to know the position where JSON ends and data starts.
I've managed to do it using the following code, but it's kinda hacky:
import json_stream
from json_stream.select_tokenizer import rust_tokenizer_or_raise
with open('test.bin', 'rb') as test_file:
tokenizer = rust_tokenizer_or_raise()(test_file, correct_cursor=True)
header = json_stream.load(self._file, tokenizer=lambda _: tokenizer)
# parse header here...
tokenizer.park_cursor()
binary_start = test_file.tell() + 1
print(binary_start)Having a cleaner and documented way to do it in json-stream would be very nice.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels