
Hello friends!
Welcome to this week’s Sloth Bytes. I hope you had a great week!

🦥 No selling out today
I am genuinely considering selling feet pics, so if you work at a company with a marketing budget please forward this to your boss immediately or the feet come out.

How Do Files Work In The Cloud?

You’ve probably uploaded files to Dropbox, Google Drive, or some other random website.
It works. It’s fast. It feels like magic.
But here’s the question: Where does that file actually go?
Let’s walk through how file storage in the cloud actually works.
It’s pretty interesting and good to know.
Step 1: You upload a file (or you think you did…)
You select a file. let’s say, sloth.jpg and click upload.
Your browser doesn’t teleport the file anywhere. The file is already bytes; the browser reads those bytes and sends them over the network as part of an HTTP request.
Read the file’s bytes from the local device
Encode/package those bytes according to the upload method (for example
multipart/form-dataor a raw request body)Send the HTTP request either to your application backend or directly to an object-storage service using a signed upload URL
Uploads can use POST, PUT, multipart upload, or provider-specific APIs. A common architecture is either browser → backend → object storage, or browser → object storage directly after the backend issues a short-lived signed URL.
If you're using something like fetch() or FormData, this is what's happening under the hood.
<!-- Simple example of uploading a file with HTML forms -->
<form
action="http://fakeapi/api/upload"
method="POST"
enctype="multipart/form-data" <!-- This lets us upload files -->
>
<label for="image">Image</label>
<input type="file" name="image" id="image" />
<button type="submit">Submit</button>
</form>What the backend would look like
Here’s a very simple Node.js backend to store a file.
import express from "express";
import multer from "multer";
const app = express();
const upload = multer({ dest: "uploads/" });
app.post("/upload", upload.single("image"), (req, res) => {
console.log(req.file); // info about the uploaded file
res.send("File uploaded!");
});
app.listen(3000, () => {
console.log("Server started on http://localhost:3000");
});This demo writes the file to the backend server’s local filesystem. That can be useful for development, but production apps often stream uploads to object storage instead because application instances may be ephemeral and local disks usually are not shared across servers.
Step 2: Storing the File in the Cloud (S3 Example)
The backend example doesn’t pass our image to a cloud provider.
Let’s change that.
Example of storing a file in the cloud (with S3)
// 🛠 Very simple example of uploading files to AWS S3
import { S3Client, PutObjectCommand } from "@aws-sdk/client-s3";
// Create an S3 client
const s3 = new S3Client({ region: "us-east-1" });
// Function to upload a file to S3
const uploadToS3 = async (fileBuffer, filename, mimetype) => {
// This object holds all the config details for the upload
const stuff_to_send = {
Bucket: "my-bucket",
// File path + name in the bucket
Key: `uploads/${filename}`,
// The actual file data in binary format
Body: fileBuffer,
// Helps S3 know how to serve the file (e.g. image/jpeg)
ContentType: mimetype
};
// Create the upload command with the config
const upload_file_command = new PutObjectCommand(stuff_to_send);
// Send the file to S3
const data = await s3.send(upload_file_command);
// Optional: log the response or return it
console.log("✅ File uploaded!", data);
};Now in our backend example we just pass the file data to this uploadToS3 function:
import express from "express";
import multer from "multer";
import { uploadToS3 } from "./s3.js";
const upload = multer(); // keeps this small example in memory
const app = express();
app.post("/upload", upload.single("image"), async (req, res) => {
try {
const { buffer, originalname, mimetype } = req.file;
await uploadToS3(buffer, originalname, mimetype);
res.send("✅ File uploaded to S3 successfully!");
} catch (error) {
console.error("Upload error:", error);
res.status(500).send("❌ Upload failed");
}
});Note: If this code is wrong uhh, let me know please…
So what exactly is “the cloud” doing?
Once the image reaches the cloud, that file is:
Stored as an object inside the provider’s distributed storage system
Addressed by an object key such as
uploads/sloth-123.jpg. It may look like a folder path, but object stores generally use a flat key namespace and treat the slashes as part of the key.Associated with metadata such as:
Content type (
image/jpeg)Object size
Checksums/ETags or provider metadata
Access-control and lifecycle settings
Cloud object-storage systems are engineered for durability by storing data redundantly across underlying hardware and, depending on the service/configuration, across multiple facilities or availability zones. The exact placement is provider-managed and intentionally abstracted away.
This redundancy helps protect against hardware failures, but replication is not the same thing as a backup. If you overwrite or delete an object, that change can also propagate. Features such as versioning, retention policies, lifecycle rules, and separate backups address different failure modes.
Bonus: Where does it actually live?
People love to say your file is “in the cloud”, but really, it's just sitting on someone else’s server.
That server might belong to:
Amazon - Amazon S3
Google - Google Cloud Storage
Microsoft - Azure Blob Storage
These systems use distributed storage under the hood, but you generally don’t control or even know which physical machine contains a particular byte. The provider maps your logical object key to redundant storage internally and handles repair when hardware fails.
They also use internal tools to keep track of where everything is, like a giant, super-organized file cabinet that spans the globe.
I wish I could explain those internal tools, but does it look like I’m smart enough to work there?
Uhhh what’s a blob?
“Blob” historically means Binary Large Object. In databases it can describe a binary-data type; cloud products such as Azure Blob Storage also use the word more generally for stored objects like images, videos, archives, and documents. It does not mean every cloud file is literally stored in a database BLOB column.
Step 3: Retrieving the File
When you (or someone else) wants to access sloth.jpg, the browser sends a GET request like:
const imageUrl = `https://my-bucket.s3.amazonaws.com/uploads/sloth.jpg`;For private files, you might generate a signed URL:
import { getSignedUrl } from "@aws-sdk/s3-request-presigner";
const url = await getSignedUrl(s3, new GetObjectCommand({
Bucket: "my-bucket",
Key: "uploads/sloth.jpg",
}), { expiresIn: 60 });That signed URL can be used to make an authorized request until its signature expires (60 seconds in this example). Expiration does not somehow revoke a copy that the user already downloaded; it prevents new requests using that expired URL.
There’s still a lot more about this…
If you’re curious and want to go more in-depth, check out these resources:
TL;DR
Cloud files live on real storage infrastructure. Your application sends bytes to an object-storage API; the provider stores the object redundantly, tracks it by a key plus metadata, and serves it back through authenticated or public HTTP requests.
Depending on your architecture, a request may also involve a CDN, cache, application server, signed URL, replication layer, or versioning system—but those pieces are choices, not a fixed “three data centers and two caches” journey every file takes.
Cloud storage: not magic, just invisible infrastructure.
If you want to keep learning
Cloud computing explained — understand the bigger infrastructure model behind storage, servers, and managed services.
How video game save systems work — see a practical example of local files, databases, serialization, and cloud sync working together.
The 3 types of caches — because serving files quickly usually involves caching somewhere along the way.
5 system design resources — go deeper on distributed systems, scalability, storage, and architecture.


Thanks for the feedback :)



Thanks to everyone who submitted!
Unfortunately I yapped too much in this email and have a little bit of space before it gets cut off, so I can’t mention you all today sorry 😭
Sloth's Meal Time
Sloth is a very habitual person. He eats breakfast at 7:00 a.m. each morning, lunch at 12:00 p.m. and dinner at 7:00 p.m. in the evening.
Create a function that takes in the current time as a string and determines the duration of time before Sloth's next meal.
Represent this as an array with the first and second elements representing hours and minutes, respectively.
Examples
timeToEat("2:00 p.m.")
#5 hours until the next meal, dinner
output = [5, 0]
timeToEat("5:50 a.m.")
# 1 hour and 10 minutes until the next meal, breakfast
output = [1, 10]How To Submit Answers
Reply with
A link to your solution (github, twitter, personal blog, portfolio, replit, etc)
or if you’re on the web version leave a comment!
If you want to be mentioned here, I’d prefer if you sent a GitHub link or Replit!

New videos coming out soon!
First video will be about AI agents and the second video will be about programming mistakes everyone makes.
That’s all from me!
Have a great week, be safe, make good choices, and have fun coding.
If I made a mistake or you have any questions, feel free to comment below or reply to the email!
See you all next week.
What'd you think of today's email?
Want to advertise in Sloth Bytes?
If your company is interested in reaching an audience of developers and programming enthusiasts, you may want to advertise with us here.



