Kantis / ks3

KotlinX Serialization Standard Serializers (KS3)
Apache License 2.0
19 stars 4 forks source link

Add a convenience function to (de-)serialize from / to files #144

Open sschuberth opened 2 months ago

sschuberth commented 2 months ago

Coming from this PR discussion, I wonder whether you guys have any experience with serialization performance from / to files (esp. on the JVM), an whether this library could be a good place to add a (maybe JVM-only) convenience function that uses either the string or the stream API for serialization, maybe even based on file length?

Please let me know what you think @Kantis et al!

Kantis commented 3 weeks ago

So far this project has only been focused on providing serializers, and utilities for writing serializers. I'm not really against adding it anyway though, as it's a sort-of generally useful companion to KxS. Would it make sense to add as a PR to kotlinx-serialization itself even?

If we choose to go ahead and add it in this project, my only wish is that we keep it tidy. Add the function as an extension to File or Path or something else appropriate, which the consumer would use to create a reference to the file.