Albertkaruna
Albertkaruna

Reputation: 85

Why .doc file takes more memory space than .txt file?

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

Answers (2)

user2864740
user2864740

Reputation: 61885

Self exploration:

  1. Save the document as a ".docx" file.

  2. Rename foo.docx to foo.docx.zip (all Microsoft "X-document" files are zips).

  3. 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

bjpelcdev
bjpelcdev

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

Related Questions