Javascript modification in stream