dmItemFileSize

Signature

http://CdmServer.com:port/dmwebservices/index.php?q=dmItemFileSize/alias/pointer/extension/sizeunit/format

  • alias is a collection alias
  • pointer is the id of the item for which to retrieve the size
  • extension is the file extension of the item
  • sizeunit is an integer to denote the units for the returned formatted string: 0 for bytes, 1 for KB, 2 for MB, 3 for GB
  • format can be xml or json or function. When calling the method directly through the URL, xml or json should be used. When calling the method from another function within the API (as done in dmGetItemInfo), function should be used.

Returns

An array with two items: the size in bytes (unformatted) and the formatted string based on the size unit passed in.

Example

http://CdmServer.com:port/dmwebservices/index.php?q=dmItemFileSize/mycollection/7/pdf/2/json

returns:

Array([size] => 16831177 [formatted] => 16.05 MB)

Note

This function is also called directly from dmGetItemInfo to remove the need for additional API calls.