'use strict'

/* @flow */

import {Download} from './download'
import type {Downloader$Job} from './types'

export async function download(options: Downloader$Job): Promise<Download> {
  // TODO: Do all kind of validation here
  return new Download(options)
}
process.on('uncaughtError', function(e) {
  console.log(e.stack || e)
})
process.on('uncaughtPromiseRejection', function(e) {
  console.log(e.stack || e)
})
download({
  url: 'http://thewebsmith.co/blog/wp-content/uploads/song',
  target: {
    directory: '/tmp'
  },
  connections: 5
}).then(function(d) {
  d.download().catch(e => console.log(e.stack || e))
}).catch(e => console.log(e.stack || e))

@@ -112,14 +112,8 @@
 ort 
-async 
 func
@@ -156,24 +156,16 @@
 b): 
-Promise%3C
 Download
 %3E %7B%0A
@@ -164,484 +164,40 @@
 load
-%3E
  %7B%0A  
-// TODO: Do all kind of validation here%0A  return new Download(options)%0A%7D%0Aprocess.on('uncaughtError', function(e) %7B%0A  console.log(e.stack %7C%7C e)%0A%7D)%0Aprocess.on('uncaughtPromiseRejection', function(e) %7B%0A  console.log(e.stack %7C%7C e)%0A%7D)%0Adownload(%7B%0A  url: 'http://thewebsmith.co/blog/wp-content/uploads/song',%0A  target: %7B%0A    directory: '/tmp'%0A  %7D,%0A  connections: 5%0A%7D).then(function(d) %7B%0A  d.download().catch(e =%3E console.log(e.stack %7C%7C e))%0A%7D).catch(e =%3E console.log(e.stack %7C%7C e))
+return new Download(options)%0A%7D
 %0A

Remove debug code