|
|
|
|
|
by drewgross
3516 days ago
|
|
Because it blocks anything else from happening. If on a server, it will prevent that process from handling any requests until the file has been read, and in a browser-like environment it will prevent the UI from updating and will prevent all UI interaction until the file has been read. In a simple script you run from your shell, the middle one is fine. |
|
I think it's perfectly fine to wrap standard nodeJS modules into your own module, Promisify or what not. Almost all NodeJS modules does actually use standard modules in some way, it would be very naive to suggest that the standard library should start returning Promises, as it would break almost every NodeJS module ever created.
I also think that Promises only makes sense when you only expect one return, it would note make sense to use Promises in NodeJS streams.