When writing with a stream, sometimes you might want to close the stream, which will happen asynchronously with write operations. A good example of running into this issue is a logger implementation which continuously writes logs to a file. This prevents throwing NPE when logging to not-open streams by try-catching the potential error and informing JS runtime instead.
When writing with a stream, sometimes you might want to close the stream, which will happen asynchronously with write operations. A good example of running into this issue is a logger implementation which continuously writes logs to a file. This prevents throwing NPE when logging to not-open streams by try-catching the potential error and informing JS runtime instead.