async run()

in src/commands/image/download.ts [19:30]


  async run() {
    const { args, flags } = await this.parse(ImageDownload)
    const profile = this.profile!
    const http = this.http!

    const url = new URL(`${profile.mediaApiHost}images/${args.id}`)
    const image = await http.get(url).then(_ => _.json())
    // TODO stricter types
    const secureUrl = new URL(image.data.source.secureUrl)
    const download = await http.download(secureUrl, `${flags.directory}/${args.id}`)
    this.log(download)
  }