Google Apps Script API
    Preparing search index...

    An attachment from Gmail. This is a regular Blob except that it has an extra getSize() method that is faster than calling getBytes().length and does not count against the Gmail read quota.

    // Logs information about any attachments in the first 100 inbox threads.
    var threads = GmailApp.getInboxThreads(0, 100);
    var msgs = GmailApp.getMessagesForThreads(threads);
    for (var i = 0 ; i < msgs.length; i++) {
      for (var j = 0; j < msgs[i].length; j++) {
        var attachments = msgs[i][j].getAttachments();
        for (var k = 0; k < attachments.length; k++) {
          Logger.log('Message "%s" contains the attachment "%s" (%s bytes)',
                     msgs[i][j].getSubject(), attachments[k].getName(), attachments[k].getSize());
        }
      }
    }
    
    interface GmailAttachment {
        copyBlob(): Blob;
        getAllBlobs(): Blob[];
        getAs(contentType: string): Blob;
        getBytes(): number[];
        getContentType(): string;
        getDataAsString(): string;
        getDataAsString(charset: string): string;
        getHash(): string;
        getName(): string;
        getSize(): number;
        isGoogleType(): boolean;
        setBytes(data: number[]): Blob;
        setContentType(contentType: string): Blob;
        setContentTypeFromExtension(): Blob;
        setDataFromString(string: string): Blob;
        setDataFromString(string: string, charset: string): Blob;
        setName(name: string): Blob;
    }
    Index

    Methods