enonic / doc-xp

Enonic XP > 7.0 Reference Documentation
2 stars 3 forks source link

Insufficient description of getBinary() params in lib-node #146

Open hjelmevold opened 4 years ago

hjelmevold commented 4 years ago

The parameter binaryReference has a very sparse and confusing description: https://developer.enonic.com/docs/xp/stable/api/lib-node#getbinary

In my mental model, the binaryReference param is exactly the same parameter as the name param in the corresponding getAttachmentStream() method in lib-content: https://developer.enonic.com/docs/xp/stable/api/lib-content#getattachmentstream …just that it's named differently between the two libraries. It would clean up some confusion if at least the descriptions matched in the documentation for both these methods, so people understand that they work in the same way.

Also, the doc for both of these methods could do well with some explanation of what exactly a stream is, and examples for when you'd use it (i.e. when you want to fill a response body with the contents of a file)

sigdestad commented 4 years ago

Hi. No, they are not the same at all. Attatchments in content API is a thing for handling files, with a bunch of properties and metadata. It is also available as a separate attachmentLib. Binaryreference is a special properyType for storing byte arrays. That Said, there might well be room for improvement :)