getContentAsBytes (NotesMIMEEntity - JavaScript)

Gets the content of the current MIME entity as an uninterpreted byte stream.

Defined in

NotesMIMEEntity

Syntax

getContentAsBytes(stream:NotesStream) : void

getContentAsBytes(stream:NotesStream, decoded:boolean) : void

Parameter Description
stream Output medium for the byte stream.
decoded Specify true (default) to decode the content, false to leave any encoding in place.

Usage

This method sets the stream Position at end of stream.

Examples

This button gets the content of an image/gif MIME entity and saves it to a .gif file.
// Do not automatically convert MIME to rich text
session.setConvertMIME(false);
var mime:NotesMIMEEntity = currentDocument.getDocument().getMIMEEntity();
if (mime != null) {
	if (mime.getContentType().equals("image") &&
	mime.getContentSubType().equals("gif")) {
		var stream:NotesStream = session.createStream();
		var pathname:string = "c:\\notes\\data\\temp.gif";
		if (stream.open(pathname, "binary")) {
			mime.getContentAsBytes(stream);
			stream.close();
		} else requestScope.status = "Can't open c:\\notes\\data\\temp.gif";
	} else System.out.println("Not GIF");
} else requestScope.status = "Not MIME";
// Restore conversion
session.setConvertMIME(true);