Reputation: 85
I have both .doc file and .txt file with only "1" as a content. But .doc file takes 10.9kb but .txt file only takes 1 byte.
Upvotes: 1
Views: 4416
Reputation: 61885
Self exploration:
Save the document as a ".docx" file.
Rename foo.docx
to foo.docx.zip
(all Microsoft "X-document" files are zips).
Extract foo.docx.zip
.
View the extracted XML files - most of the files related to additional metadata resources that are included in the saved Word Document.
A .doc
file is essentially just an older binary version of a .docx
file and contains similar metadata information. This can be viewed with a binary/hex editor.
(There are also structural differences when saving the content itself.)
The text file only contains the literal content - and nothing else - which is why it is the same size the content with a single byte encoding.
Upvotes: 1
Reputation: 303
A .txt file contains plain text characters of 1 byte, a .doc file includes all Word document metadata such as font style, size, page margins etc.
Upvotes: 3