Skip to content
0:00 / 0:00

#zig#asyncio#http

Building a File Downloader with Async IO in Zig

nubskr

3.5K subscribers • 6 videos on Hallway

YouTube
  • Recommended by 1 person: 1 in engineering communities.
  • May be out of date. The tools, versions or practices it shows have likely moved on.

Intermediate. Assumes working knowledge.

6.6K views4 months ago1 recommendation

Programming languagesSystems programmingZigConcurrency and parallelismNetworking and protocols

nubskr builds a concurrent file downloader in Zig 0.16 using the new async IO features to fetch ranged chunks.

reference code: gist.github.com/nubskr/c2b4a4ce3c16214c18718e24471520c6 patreon: patreon.com/cw/nubskr github: github.com/nubskr twitter: x.com/nubskr In this video, I build a file downloader in Zig using async IO. The downloader fetches upstream metadata, reads the file size, checks range support, splits the file into byte ranges, sends chunk requests, and writes each chunk into the correct place on disk. The goal is simple: give it a URL, download the file in ranged chunks, and end up with the actual file. Chapters: - Teaser - Intro - Parsing CLI arguments - Parsing URL components - Fetching file metadata from the server - Inspecting file metadata - Parsing content size from headers - Downloading file chunks - Making ranged HTTP requests - Downloading file synchronously - Verifying file integrity with hashes - One connection is too slow - Downloading multiple chunks in parallel - Hunting bugs - Testing async chunk download - What’s next #zig #systemsprogramming #asynchronousprogramming

Why it's here

1 person recommends this

What people say. Recommended as a practical demonstration of using Zig 0.16's new async IO capabilities for network programming.

u/Ok_Marionberry8922in r/Zig • Recommends

Building a File Downloader with zig 0.16.0 Async IO