#Getting MIME type and byte count of a resource

7 messages · Page 1 of 1 (latest)

sudden haven
#

I'd like to be able to populate the <enclosure> tag of an RSS feed item with the required type (MIME type) and length (byte count) of the linked resource.

I'd appreciate any suggestions on how to get this info.

My initial attempt at getting the byte count began with this:

import fs from 'fs';
...
fs.stat('<a valid relative path to an image>', (err, fileStats) => {
  if (err) {
    console.log(err);
  } else {
    console.log(fileStats);
  }
});

But that gave me the error: Error: ENOENT: no such file or directory, stat <path to image>

So: MIME type and byte count of a resource for use in an rss endpoint? Suggestions welcome!

mystic sirenBOT
#
No-one around right now?

It looks like no-one has responded to your question yet. People might not be available right now or don’t know how to answer your question. Want an answer while you wait? Try asking our experimental bot in #1095492539085230272.

lament plume
#

are you sure about the path? its probably not pointing where you think it is

sudden haven
#

are you able to get the same code working in your installation?

lament plume
#

You can log the path and see if its correct