stream_wrap: use `uv_try_write` where possible

Use `uv_try_write` for string and buffer writes, thus avoiding to do
allocations and copying in some of the cases.