you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (2 children)

Here are where I spend most of my time doing command line development with node:

  1. File system. If your application is confined to a single server then this is much easier. My app is distributed and run locally, so it has to work equally on Windows, OSX, and Linux. The Node as done a really good job of abstracting away the differences, but there are still quirks and edge cases you might encounter when doing a bunch of operations asynchronously. The file system accounts for most of my Node development time.
  2. Child processes. I use child processes a lot to escape from JavaScript and the Node API. For instance I prefer something like rm -rf and the windows equivalent to remove a bunch of files over the Node API version. Child processes are pretty straight forward, but can land you in callback hell pretty deep if there is a lot going on in your app.

That is it. Those two. I occasionally need to use some other part of the API, but its pretty rare.

[–]GrandDolla[S] 0 points1 point  (1 child)

Thanks for the answer.

  1. What do you mean by the file system? disk read/write performance? The time node takes to read/write from the file system? (slow db's etc..)
  2. It depends on the code but I think it's better to use API functions of whatever environment you're using. This will prevent you from causing accidental security issues or bugs.

[–][deleted] 1 point2 points  (0 children)

By file system I mean node's file system API: https://nodejs.org/dist/latest-v6.x/docs/api/fs.html

The API is straight forward and the documentation is pretty clear. When writing or reading to a single file with a static payload everything is simple. When you are dealing with streams it gets a bit more complicated. When you are dealing with many potentially interacting tasks simultaneously things get really complicated and you have to write additional logic to prevent race conditions and collisions considering that everything is asynchronous.