@nutrient-sdk/document-engine-mcp-server
Version:
MCP server for Nutrient Document Engine
19 lines (18 loc) • 646 B
JavaScript
/**
* Format file size in a human-readable format
*/
export const formatFileSize = (bytes) => {
if (bytes === 0)
return '0 B';
const sizes = ['B', 'KB', 'MB', 'GB', 'TB'];
const i = Math.floor(Math.log(bytes) / Math.log(1024));
const value = bytes / Math.pow(1024, i);
const precision = value >= 10 ? 0 : 1;
return `${value.toFixed(precision)} ${sizes[i]}`;
};
/**
* Format annotation location for display. AnnotationBBox: [left, top, width, height]
*/
export function formatBBox(coordinates) {
return `(left:${coordinates[0]}, top:${coordinates[1]}, width:${coordinates[2]}, height:${coordinates[3]})`;
}