Updated to use temp storage.

Will use TEMP_DIR if available, but fall back to the OS tmp directory;
updated the main script in package.json.