Converts a stream to a string and supports promises.