node.js create and/or append to file
===

Using node.js I'm creating a function to update a file that contains a JSON list by appending a new element to the list. The updated list is rewritten back to the file. If the file doesn't exist I create it.

Below, `__list_append(..)` does the list append and file update.

My question is if (and should) I can restructure this code to not have two calls to `__list_append`. I'm a bit new to node.js, and don't have a good feel for the asynchronous tactics.

    function list_append(filename, doc) {
      fs.exists(filename, function(exists) {
        if (exists) {
          fs.readFile(filename, function(err, data) {
            if (err)
              throw err;
            __list_append(filename, JSON.parse(data), doc);
          });
        } else
          __list_append(filename, [], doc);
      });
    }

