From cd2a727e23f959964eae3e83406cd059e3d59605 Mon Sep 17 00:00:00 2001 From: Tzahi12345 Date: Fri, 7 Apr 2023 21:01:08 -0400 Subject: [PATCH] Added some documentation to downloader.js --- backend/downloader.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/backend/downloader.js b/backend/downloader.js index 524e71b..ac60b3a 100644 --- a/backend/downloader.js +++ b/backend/downloader.js @@ -28,6 +28,25 @@ if (db_api.database_initialized) { }); } +/* + +This file handles all the downloading functionality. + +To download a file, we go through 4 steps. Here they are with their respective index & function: + +0: Create the download + - createDownload() +1: Get info for the download (we need this step for categories and archive functionality) + - collectInfo() +2: Download the file + - downloadQueuedFile() +3: Complete + - N/A + +We use checkDownloads() to move downloads through the steps and call their respective functions. + +*/ + exports.createDownload = async (url, type, options, user_uid = null, sub_id = null, sub_name = null, prefetched_info = null) => { return await mutex.runExclusive(async () => { const download = {