Skip to content

Download binary file

This tutorial is part of package functions documentation in Iconify Tools.

Function downloadFile() is a wrapper for fetch that downloads binary file.

It is used by functions that retrieve archives in download functions, such as downloadGitHubRepo() and downloadNPMPackage().

To retrieve text files, see sendAPIQuery().


Function has the following parameters:

  • query, APIQueryParams. URI and parameters.
  • filename, string. Where to store file.

Function is asynchronous. That means you need to handle it as Promise instance, usually by adding await before function call.


APIQueryParams object has the following properties:

  • uri, string. Base URI.
  • params, URLSearchParams. Optional parameters.
  • header, Record<string,string>. Optional headers.

Released under the Apache 2.0 License.