KB Article #163869

How to Get the Message Size using JavaScript

How to Get the Message Size using JavaScript

 
function invoke(msg)         {
      var body = msg.get("content.body");
      var size = 0;
      if (body != null) // HTTP GETs have no body
         size = body.getContentLength(0);
      msg.put("msg.size", size);
      return true;
}