Huffman compression in Notes

Wednesday 4 December 2002

A recent email correspondent asked:

How can I decompress the huffman-compressed file attachments in Notes?

The answer is: you can't. The Notes C API provides no facility to do this, and Lotus (or IBM or Iris, or whatever they should be called now) has never documented the compression algorithm. The only way to decompress these attachments is to use the C API functions NSFNoteExtractFile or NSFNoteExtractFileExt. Both of these functions take a filename, and the decompressed data is written to the file.

Of course, this is really stupid. For one thing, when writing high-throughput software, the last thing you want to do is write more data to disk. If I need to process the data in a file attachment, I want a way to read the data into memory, and writing it to a temp file just to read it back in so I can do whatever to it, is just wasteful.

Of course, IBM (or Lotus or Iris, or whatever) has functions to do the decompression, they just haven't been exposed as part of the C API.

I used to work at Iris (or Lotus, or whatever), but I don't know how the compression works, or what the functions are to do the decompression. I'd like to have access to them as well, but I'm in the same boat as everyone else.

tagged: » 1 reaction


sendhil 9:59 AM on 16 Dec 2004

Hi Ned,

I really am in trouble trying to use the NSFNoteExtractFile. I could not ask anyone else other than yourself. I have seen all the posts on and none seem to give me a working answer. The requirement is quite simple. Detach attachments to a folder of all the messages going through a mail box. I have written a extension manager and that goes through all the $FILE items one by one using the NSFItemInfo and NSFItemInfoNext and for every BLOCKID it finds it tries to call NSFNoteExtractFile. Just before I call NSFNoteExtractFile i also find the name of the original attachment using the FILEOBJECT structure read from the items value BLOCKID. I always get the same error "Specified database is not currently open". Now the documentation says that if the extension manager event is EM_BEFORE then all the handles will be valid. So i have tried it on EM_BEFORE and EM_AFTER. Nothing seems to be working. I can mail you the entire source code if you want. But I will post your solution to and you will be helping not only me but quite a few people.

Thanks in advance.

Add a comment:

Ignore this:
not displayed and no spam.
Leave this empty:
not searched.
Name and either email or www are required.
Don't put anything here:
Leave this empty:
URLs auto-link and some tags are allowed: <a><b><i><p><br><pre>.