garethbjohnson/gutendex

File Size

Opened this issue · 2 comments

Hi,
Sorry to ask so many questions. I was wondering if it might be possible to get the file size of each file. It can be helpful to estimate how long a book is :).

Hi again, no worries, that is another good idea. I found a number value in the Gutenberg catalogue XML files that seems to roughly match the number of bytes in each book format's file.

To alter what I suggested in the last issue thread (#35), I could instead make "all_formats" an array of objects with properties for media type, file URL, and file size:

{
  ...
  "formats": {
    ...
    "application/x-mobipocket-ebook": "https://www.gutenberg.org/ebooks/84.kf8.images",
    ...
  },
  "all_formats": [
    ...
    {
      "media_type": "application/x-mobipocket-ebook",
      "size": 448727,
      "url": "https://www.gutenberg.org/ebooks/84.kindle.images"
    },
    {
      "media_type": "application/x-mobipocket-ebook",
      "size": 476477,
      "url": "https://www.gutenberg.org/ebooks/84.kf8.images"
    },
    ...
  ],
  ...
}

Would that work for you?

Thank you, that works! Commented in the other issue