Streaming state management for node and the browser