NodeJS Synchronous vs Asynchronous programming
The async package provides functions for asynchronous code.
Using the auto function you can define asynchronous relations between two or more functions:
This code could have been made synchronously, by just calling the get_data, make_folder, write_file and email_link in the correct order. Async keeps track of the results for you, and if an error occurred (first parameter of callback unequal to null) it stops the execution of the other functions.