Implement option to get stream instead of buffer