Popular view tells us that any kind of information is just a collection of bits, that is zeroes and ones placed in a particular order. I was thus having this thought.Suppose that I have some kind of file such as a text document, a PDF or anything else and that I also have a memory so perfect that I can remember the file exactly in its binary format, i.e. the number and place of zeroes and ones. But nothing else.My question would then be if, in practice, it would be possible to reconstruct my initial file (without imposing any assumptions on what format it takes) from just this binary format.Please be advised that I am not an expert in computer science and I do have only some very basic understanding. I do hope though this question fits here.
Reconstructing files from binary
encoding scheme
First notice that a file is a sequence of 0s and 1s in binary format that are stored in some kind of persistent storage (an hard disk, a CD, an USB key, ...).According to the the type of information stored in the file (a plain text, a PDF document, an image, a video, a song,  ...) its bits (bytes) are usually arranged using standard rules and they have precise meaning: they follow a file format which specifies how information is encoded in the file.Usually the name of the file (filename) has an extension (.mp3, .txt, .jpg, .pdf, .tex, ...) that indicates the file format i.e. how information is encoded. Computer programs like text editors, image editors, video players, music players, ... can read a file in one (or more) format and decode the information stored in it (show the text on the screen, play it, process it, ... ).Now suppose that you have a bunch of bytes in your head. First you can write them directly in a file using a program like a binary editor. When they are stored in a file, you need to discover its file format ...first you can try to display it as a text file (like suggested by saadtaame in his answer): many file formats (text data, html files, xml files, ...) store the information in plain text (ASCII);or you can change its extension (.pdf, .jpg, .mp3, .gif, .avi, ...), and try to open it with some standard programs ... if you are lucky you'll find one that opens it correctly;or you can do something smarter. You can examine the first bytes of the file (header): they usually have a particular structure or contains specific fixed characters that allow you to quickly find the file format of the whole file.For example the bytes 6,7,8,9 of a JPEG file are always 0x4a 0x46 0x49 0x46, which correspond to the string JFIF in ASCII. Windows PE executables contain the string This program cannot ... in the header. The first two bytes of a file in ZIP format are PK, and so on ...But there are thousands of file formats out there, so you can also consider using a computer program that given an unknown file can help you to find its file format automatically.Finally don't forget that the information in a file can also be encrypted or the file format can be proprietary (and closed, i.e. undocumented); in these cases there are very little probability (zero?) to decode the information stored in the files.