Don't serialize from stdin. Read it all up front (add header with
expected size).