Sample code for 30+ languages & platforms
React Native Requires Chilkat v11.0.0+

Extract Files from MIME

See more MIME Examples

Extract files from a MIME message.

Chilkat React Native Downloads

React Native
import { Mime, StringTable } from '@chilkat/react-native'

function chilkatExample() {
  // This example requires the Chilkat API to have been previously unlocked.
  // See Global Unlock Sample for sample code.

  const mime = new Mime();

  // Load a MIME document from a file:
  // (.mht and .eml files contain MIME).
  try {
    mime.loadMimeFile('mst.mht');
  } catch {
    console.log(mime.lastErrorText);
    return;
  }

  const st = new StringTable();
  try {
    mime.partsToFiles('/temp/mimeParts', st);
  } catch {
    console.log(mime.lastErrorText);
    return;
  }

  const n = st.count;

  // Display the paths of the files created:
  let i = 0;
  while (i < n) {
    console.log(st.stringAt(i));
    i++;
  }
}