What is a File?

Ken Fowler

-

Thu May 30 2024

blog post image

Intro

I'm going down a bit of a rabbit hole here. I recently created a web application that had a file upload feature and I got to thinking - How does that work? How can a user upload a file to my web application, send it across the internet, and have that file be reconstituted in my cloud storage service?

After giving this some thought I think a good place to start is with understanding what a file is.

What is a file?

At the root of it all, files are are binary data. A bunch of ones and zeros that carefully organized so that, when interpreted correctly, represent a meaningful output.

Along my journey to understanding what a file is I learned that you can open a file with a hex editor. Without straying too much, here's a little bit about what that is from Wikipedia:

A hex editor (or binary file editor or byte editor) is a computer program that allows for manipulation of the fundamental binary data that constitutes a computer file. The name 'hex' comes from 'hexadecimal', a standard numerical format for representing binary data.

So, there we go! We can see that a file is just carefully organized bits and bytes. You can examine the bits and bytes that document and image viewers read from with a hex editor and see for yourself.

Example

Here is an HTML image tag with an image file of a small red dot embedded directly into the tag. Take a look at the html in the developer tools tab to see!

Embedded Image

You can see that the string of seemingly nonsense characters in the img src="..." attribute can be interpreted by the browser as an image file.

Comments

Ken Fowler

-

Thu May 30 2024

testing...

Ken Fowler

-

Thu May 30 2024

Hello, World!