Need help with File.slice(), File.size and File.type


Hopefully someone can help here since I am confused.

Blob has the method Blob.slice() and the properties Blob.size and Blob.type. File inherits from Blob, so the same method and properties are also available inside File. But how do we document this?

From what I understand, Blob.slice(), Blob.size and Blob.type should be documented in Blob. The File overview should mention that it inherits from Blob but should not include the Blob method and properties there to avoid duplicate information. Also, there should be no pages File.size and File.type since those are duplicated from Blob.

I disagree that all the documentation should only be in Blob. Someone looking for File documentation will want to find the size of a file, and will be confused why there is no File.size. The fact that File inherits from Blob is hard to find for someone new to JS.

Ideally, Blob.slice(), Blob.size and Blob.type would be mentioned both on the File overview, as well as inside the File sidebar. Is it possible to add these pages to the File sidebar (via a tag or in Kumascript) without creating a File.size page etc., and can we change the policy and allow those method and properties to be mentioned on the File overview?

Also, someone will need to delete File.size and File.type since I don’t have permission for that.

(Eric Shepherd) #2

The things you mention should indeed be in the sidebar there. We need to see what’s involved in making that happen. I don’t know if it can be done easily without updating the sidebar generating macro in use there.

Actually, I think we can eventually do something where if the stuff is inherited, it shows up anyway. So that in your example, when you go to the main File overview page, you’d actually see links to all the stuff that’s inherited right there instead of having to go to Blob to see it.

This is part of where the end goal of the macros that build lists of articles is aimed to go. See the not-yet-quite-finished macro [InterfaceOverview](

This macro is used on an API overview page and builds the list sof properties, methods, event handlers, etc. What I’d like to do is instead of just showing “Inherits from…” text, to actually go to the interfaces from which it inherits and include its stuff as well.

There’s work to be done there, yet, but it’s totally feasible and would make creating an API’s overview page almost trivial. Not to mention it would be able to be updated automatically as new stuff is added to the interface(s).

Eric Shepherd
Senior Technical Writer
MDN Web Docs: