How to get document size info in the custom event listener?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-15-2024 07:09 AM
In custom event listener handler that listening documentCreated or documentModified event, how can i get the document size info ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-15-2024 10:46 AM
What do you mean by "document size info"?
If what you meant is main binary (file:content) file size, if the info was provided when the blob was uploaded, in a Java Event Listener you can retrieve it using the following code (Blob class from package org.nuxeo.ecm.core.api):
((Blob) doc.getPropertyValue("file:content")).getLength()
The value will be expressed in bytes if known, else it will be -1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-16-2024 04:55 AM - edited 10-16-2024 04:56 AM
Hi, thanks for quick reply. The answer may work in most scenes, but not for all the document types.
what I want is to get the specific space usage of the document when a got an document is created or modified( in the event handler) , How to do that ?
