Skip to content

Latest commit

 

History

History
67 lines (41 loc) · 1.99 KB

File metadata and controls

67 lines (41 loc) · 1.99 KB

Download

Extends: EventEmitter
Save files downloaded from the web

new Download()

Params

  • none

Create instance of class Download

download.fromURL(url, fileName)

Params

  • url string - The url of the file to be downloaded
  • fileName string - The name of the file to save to (without extension).

Download file from url and save to fileName

Returns: Promise | string - The name of the saved file

download.fromCSV(csvFile, destDir, options)

Emits: success, error
Params

  • csvFile string - Name of the csv file
  • destDir string - Destination directory
  • options Object
    • .urlColumn string - The column name in csvFile containing the url
    • .filenameColumns Array.<string> - Array of column names in the csvFile to be used as part of the name of the output file
    • [.format] Object = {headers: true, delimiter: ";", rowDelimiter: "\r\n", quoteColumns: true} - Format of the csv file
    • .year integer - Year, used as part of the name of the output file
    • [.concurrency] integer = 1 - Number of concurrent downloads

Download files mentioned in csvFile and save them in destDir

"success"

  • The url of the downloaded file

"error"

  • Error message