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!