Skip to main content
Native files are binary documents (PDFs, images, Word files, etc.) embedded within a KDDB document. The kdx document natives commands let you list and extract these files.

Commands

List Native Files

View all native files embedded in a document:
kdx document natives list <file.kddb>
Example:
kdx document natives list invoice.kddb
┌────┬──────────────┬─────────────────┬────────┐
│ ID │   FILENAME   │    MIMETYPE     │  SIZE  │
├────┼──────────────┼─────────────────┼────────┤
│ 1  │ original.pdf │ application/pdf │ 245632 │
│ 2  │ signature.png│ image/png       │  12480 │
└────┴──────────────┴─────────────────┴────────┘
If no native files are found:
No native files found in document

Extract Native Files

Extract a native file to disk:
kdx document natives extract <file.kddb> <filename-or-id> [flags]
Flags:
FlagDescription
-o, --outputOutput file path (default: original filename)
Examples:
# Extract by filename
kdx document natives extract invoice.kddb original.pdf

# Extract by ID
kdx document natives extract invoice.kddb 1

# Extract to a specific path
kdx document natives extract invoice.kddb original.pdf -o /tmp/extracted.pdf
Output:
Extracted original.pdf (245632 bytes) to original.pdf

Output Formats

Use the global -o flag for different output formats:
# JSON output for scripting
kdx document natives list invoice.kddb -o json

# YAML output
kdx document natives list invoice.kddb -o yaml
JSON output example:
[
  {
    "id": 1,
    "filename": "original.pdf",
    "mimeType": "application/pdf",
    "size": 245632
  },
  {
    "id": 2,
    "filename": "signature.png",
    "mimeType": "image/png",
    "size": 12480
  }
]

Use Cases

Extract All Files

Extract all native files from a document:
# List files and extract each one
for file in $(kdx document natives list invoice.kddb -o json | jq -r '.[].filename'); do
  kdx document natives extract invoice.kddb "$file"
done

Verify Original Document

Check if the original source file is preserved:
# Check for PDF
kdx document natives list processed.kddb | grep -i pdf

Batch Processing

Extract specific file types across multiple documents:
# Extract all PDFs from all KDDB files
for kddb in *.kddb; do
  echo "Processing $kddb..."
  kdx document natives list "$kddb" -o json | jq -r '.[] | select(.mimeType == "application/pdf") | .filename' | while read filename; do
    kdx document natives extract "$kddb" "$filename" -o "extracted/${kddb%.kddb}_$filename"
  done
done

Common MIME Types

File TypeMIME Type
PDFapplication/pdf
Word (docx)application/vnd.openxmlformats-officedocument.wordprocessingml.document
Excel (xlsx)application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
PNGimage/png
JPEGimage/jpeg
TIFFimage/tiff
Plain Texttext/plain

Notes

Native files are stored compressed (gzip) within the KDDB file. The extract command automatically decompresses the data when writing to disk.
Not all KDDB documents contain native files. Documents created from text input or API responses may not have embedded originals.