Update index.js

Update download function with eventEmitter