Skip to main content

Add a thin wrapper for calling curl with resumable downloads

ID
b0e13ef
date
2024-01-29 10:39:38+00:00
author
Alex Chan <alex@alexwlchan.net>
parent
c455953
message
Add a thin wrapper for calling curl with resumable downloads
changed files
2 files, 30 additions, 1 deletion

Changed files

web/README.md (2601) → web/README.md (3055)

diff --git a/web/README.md b/web/README.md
index bd15b7d..ba5f1e3 100644
--- a/web/README.md
+++ b/web/README.md
@@ -30,6 +30,12 @@ scripts = [
         """
     },
     {
+        "usage": "rcurl [URL]",
+        "description": """
+        call curl with a couple of flags that allow it to do resumable downloads, which is useful for large files.
+        """
+    },
+    {
         "name": "scrape_really_useful_boxes.py",
         "description": """
         scrape the Really Useful Boxes product catalogue, so I can search for boxes in ways their website doesn't allow – in particular, by dimensions, so I can find boxes that fit into specific spaces.<br/><br/><img src="really_useful_boxes.png">
@@ -66,6 +72,15 @@ cog_helpers.create_description_table(folder_name=folder_name, scripts=scripts)
   </dd>
 
   <dt>
+    <a href="https://github.com/alexwlchan/scripts/blob/main/web/rcurl">
+      <code>rcurl [URL]</code>
+    </a>
+  </dt>
+  <dd>
+    call curl with a couple of flags that allow it to do resumable downloads, which is useful for large files.
+  </dd>
+
+  <dt>
     <a href="https://github.com/alexwlchan/scripts/blob/main/web/scrape_really_useful_boxes.py">
       <code>scrape_really_useful_boxes.py</code>
     </a>
@@ -83,4 +98,4 @@ cog_helpers.create_description_table(folder_name=folder_name, scripts=scripts)
     this is a wrapper around <a href="https://github.com/yt-dlp/yt-dlp">yt-dlp</a> that does parallel downloads of videos in playlists.
   </dd>
 </dl>
-<!-- [[[end]]] (checksum: ba9551c2698692a04b0fc4c5a45c7cf5) -->
+<!-- [[[end]]] (checksum: 70f416e98a07e5eaaea25d6062547eb4) -->

web/rcurl (0) → web/rcurl (238)

diff --git a/web/rcurl b/web/rcurl
new file mode 100755
index 0000000..800970b
--- /dev/null
+++ b/web/rcurl
@@ -0,0 +1,14 @@
+#!/usr/bin/env bash
+# r(esumable) curl.
+#
+# This just calls curl with a couple of flags that allow it to resume
+# an in-progress download.
+
+set -o errexit
+set -o nounset
+
+curl \
+  --location \
+  --remote-name \
+  --continue-at - \
+  "$1"