Archived Forum Post

Index of archived forum posts

Question:

Is there a way to convert a .mht file to a site (images etc.) on Linux?

Aug 19 '16 at 06:52

Hello,

I saw that there's a "UnpackMHT" on the IOS side, anything similar for Linux, in Perl or Python? I found some sample Perl code using chilkat::CkMime();, but it didn't produce anything after setting the .mht filename and target directory in it, and produced no errors. The sample code I used is below.

Thanks,

  -Adam

!/apps/perlthreaded/bin/perl

use chilkat();

$mime = new chilkat::CkMime();

$success = $mime->UnlockComponent("Anything for 30-day trial."); if ($success == 0) { print "Failed to unlock component" . "n"; exit; }

Load a MIME document from a file:

(.mht and .eml files contain MIME).

$success = $mime->LoadMimeFile("./test.mht"); if ($success == 0) { print $mime->lastErrorText() . "rn"; exit; }

sa is a StringArray

$sa = $mime->ExtractPartsToFiles("/home/oracle/site"); if ($sa eq null ) { print $mime->lastErrorText() . "rn"; exit; }

$n = $sa->get_Count();

Display the filepaths of the files created:

for ($i = 0; $i <= $n - 1; $i++) { print $sa->getString($i) . "rn"; }


Answer

The Chilkat API is essentially identical (other than syntax) across all programming languages and operating systems. The UnpackMHT method is available everywhere, including Linux.