romshark / jscan

High performance JSON iterator & validator for Go
BSD 3-Clause "New" or "Revised" License
89 stars 7 forks source link

Add io.Reader support #19

Open KernelPryanic opened 1 year ago

KernelPryanic commented 1 year ago

Scan requires loading big JSON files into memory. In situations where memory is limited and/or the JSON files are too big reading from io.Reader would be required.

romshark commented 1 year ago

Support for io.Reader is already in the works. Since it requires extensive changes to the API and the algorithm I decided to include it in later feature bumps above v2.0.0.

io.Reader support for ScanOne and ValidateOne will be impossible to implement. Instead something like this will be necessary:

func ScanStream(io.Reader, onValue func(*IteratorReader), onTerminator func(*IteratorReader)) ErrorReader
func ValidateStream(io.Reader) ErrorReader