UNPKG

@softchef/cdk-iot-device-management

Version:

IoT device management is composed of things, thing types, thing groups, jobs, files API services. The constructs can be used independently, that are based on full-managed service to create an API Gateway & Lambda function.

20 lines (19 loc) 553 B
export function calculateBodyLength(body) { if (typeof body === "string") { var len = body.length; for (var i = len - 1; i >= 0; i--) { var code = body.charCodeAt(i); if (code > 0x7f && code <= 0x7ff) len++; else if (code > 0x7ff && code <= 0xffff) len += 2; } return len; } else if (typeof body.byteLength === "number") { return body.byteLength; } else if (typeof body.size === "number") { return body.size; } }