Loading TOC...

MarkLogic Server 11.0 Product Documentation
xdmp.externalBinary

xdmp.externalBinary(
   path as String,
   [starting-location as Number],
   [length as Number]
) as binary()

Summary

Returns an external binary node.

Parameters
path Filesystem path to the external binary file.
starting-location The new binary node starts at the byte position indicated by starting-location. The first byte is at location 1. The default value is 1.
length The length in bytes of the content in the new binary node. Omitting the length has performance implications; see usage notes.

Required Privileges

http://marklogic.com/xdmp/privileges/xdmp-external-binary

Usage Notes

If no length is provided, the length is calculated from the starting position and the filesystem length of the external file. If the file does not exist when the length is calculated, XDMP-MISSINGFILE is thrown.

If a length is provided, the length is trusted. That is, no attempt is made to confirm the existence or read the length of the external file. Therefore, including the length in the call (if known) results in the best performance during document creation.

The external binary format is best suited for read-only content managed external to MarkLogic Server. If the content is changed externally, the Compressed Tree Cache (CTC) should be cleared across the entire cluster, since the MarkLogic Server will not automatically reload the binary into the CTC.

Example

  xdmp.externalBinary("/testdata1/logo.gif", 1, 2456);

  => A binary node representing the external file at
     /testdata1/logo.gif, beginning at offset 1, with
     a length of 2456 bytes.

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.