isar / isar/hive

Redirect serialization output?

Open
#1,314 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Dart
Stars
4.4k
Forks
449
PR merge metrics
No merged PRs in 30d

Description

Hive under the hood uses the TypeAdapters to transform the HiveModels in a Box into binary data that is written into a file AFAIK. And then read the other way round when needed.
Is there a simple way to redirect this serialization into some sort of stream, e.g. for transmitting the data over a network? Ideally without writing your own implementation of BinaryReader and BinaryWriter.
(Background of the question: I have a set of several dozen HiveModels and am looking for a way to create a backup mechanism without implementing a second serialisation method on top of the hive models...)

The easiest and only way I can think of is just copying the box files. (Which, of course, for encrypted boxes requires later reading them with the same AES key).
Any other suggestions?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading the TypeAdapters, BinaryReader, and BinaryWriter APIs and how box files are written and read. Determine whether serialization can be redirected to a stream without duplicating the model serialization, including the encrypted-box case. Done means the supported approach or required API is clearly established and covered by relevant tests or documentation.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart
Domain
databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.