cancel
Showing results for 
Search instead for 
Did you mean: 

How to get document size info in the custom event listener?

gaosh
Champ on-the-rise
Champ on-the-rise

In custom event listener handler that listening  documentCreated or  documentModified event,  how can i get the document size info ? 

2 REPLIES 2

Jordann_Rousse1
Employee
Employee

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

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 ?   

 

Getting started

Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.