Class
Returns the public URL for the given content key. For the local driver,
this is the path under /public/ that Next.js serves. For the S3
driver, this is the bucket URL (and optionally signed).
Returns whether a blob for the given key exists in the underlying store. Used by the seed generator to verify content is present, and by future code paths that need to surface "missing media" states.
Reads a bounded UTF-8 text blob for a known text key. Implementations
MUST validate that the key is safe (no absolute prefixes, no .. path
segments) and reject keys that point to binary asset types before
returning any text. Missing or non-text keys reject; the read is not
a general arbitrary-path API.
Reads an object's raw bytes, for copying it to another store.
Writes an object's raw bytes, creating or replacing it.
Removes an object. Used only after a verified copy.
Driven adapter: filesystem-backed
BlobStore.Resolves a content
key(e.g.,advanced-intermediate-course/.../lesson.mp4) to a URL served by Next.js from/public/, AND checks whether the underlying file exists on disk.The constructor takes TWO separate arguments on purpose — mixing the URL prefix with the filesystem path is a footgun.
baseUrlis the public URL prefix (no trailing slash),localRootis the absolute filesystem path the content lives under. They MUST be passed explicitly; the constructor does not derive one from the other.Migration story: a future
S3BlobStorewill replace this implementation without changes to the lesson/resource adapters. The constructor shape (separating "what the URL looks like" from "where the bytes live") is the contract the S3 driver will mirror with{ bucket, region, cdnUrl? }.