## Library usage To use `patreon-dl` in your own project: ``` import PatreonDownloader from 'patreon-dl'; const url = '....'; const downloader = await PatreonDownloader.getInstance(url, [options]); await downloader.start(); ``` Here, we first obtain a downloader instance by calling `PatreonDownloader.getInstance()`, passing to it the URL we want to download from (one of the [supported URL formats](#supported-url-formats)) and [downloader options](#downloader-options), if any. Then, we call `start()` on the downloader instance to begin the download process. The `start()` method returns a Promise that resolves when the download process has ended. - To monitor status and progress, see [Workflow and Events](#workflow-and-events). - To abort a download process, see [Aborting](#aborting). ### Downloader options An object with the following properties (all *optional*): | Option | Description | |-----------------|-------------------------------------------------------------| | `cookie` | Cookie to include in requests; required for accessing patron-only content. See [How to obtain Cookie](https://github.com/patrickkfkan/patreon-dl/wiki/How-to-obtain-Cookie). | | `useStatusCache` | Whether to use status cache to quickly determine whether a target that had been downloaded before has changed since the last download. Default: `true` | | `stopOn` | Sets the condition to stop the downloader. Values can be: Deprecated values:Default: `never`| | `pathToFFmpeg` | Path to `ffmpeg` executable. If not specified, `ffmpeg` will be called directly when needed, so make sure it is in the PATH. | | `pathToDeno` | Path to `deno` executable. This is used by the built-in YouTube downloader to sandbox executed code at runtime. If not specified, `deno` will be called directly when needed. If `deno` is not found, the built-in downloader will evaluate code without sandboxing. | | `pathToYouTubeCredentials` | Path to file storing YouTube credentials for connecting to a YouTube account when downloading embedded YouTube videos. Its purpose is to allow YouTube Premium accounts to download videos at higher than normal qualities. For more information, see [Configuring YouTube connection](#configuring-youtube-connection). | `maxVideoResolution` | Maximum video resolution to download (height in pixels). Only applies to Patreon-hosted videos and embedded YouTube videos when using the built-in YouTube downloader. If not set, or value is `0`, negative or `null`, the best available quality will be downloaded. | | `outDir` | Path to directory where content is saved. Default: current working directory | | `dirNameFormat` | How to name directories: (object) | | `filenameFormat` | Naming of files: (object)