Byte size add
bytesize-add · version 1.0.0 · Units & sizes · free, no key needed
Add non-negative integer byte-size terms in mixed IEC units and return the exact sum in a chosen unit.
Use when you need to: bytesize add · add binary byte sizes · sum kibibyte amounts.
Supported
- bytesize add
- add binary byte sizes
- sum kibibyte amounts
Not supported
- SI kB/MB/GB
- bits
- signed byte sizes
- more than 32 terms
- subtract byte sizes
Behavior
- terms is an array of 1 to 32 objects, each with a non-negative canonical integer value and a byte-size unit.
- Units are exactly B, KiB, MiB, GiB, TiB using the BYTE_SIZE table (powers of 1024).
- Each term is converted to bytes as a BigInt and those amounts are summed.
- If the byte sum exceeds 1000 digits, the call is rejected.
- The byte sum is converted to the to unit as a reduced canonical rational.
- Input -0 is canonicalized to 0; other negatives, SI decimal prefixes, and bit units are rejected.
Input
terms(array of object, required): min items 1; max items 32to(one of "B", "KiB", "MiB", "GiB", "TiB", required)
Output
numerator(string, required): pattern^(0|[1-9][0-9]*)$denominator(string, required): pattern^[1-9][0-9]*$
Limits
- max digits: 1000
- max terms: 32
- units: ["B","KiB","MiB","GiB","TiB"]
Example
Request input:
{
"terms": [
{
"value": "1",
"unit": "KiB"
},
{
"value": "512",
"unit": "B"
}
],
"to": "B"
}
Response:
{
"result": {
"numerator": "1536",
"denominator": "1"
}
}
How to call it
MCP
Connect https://computefirst.net/mcp (setup), then call execute with:
{
"id": "bytesize-add",
"version": "1.0.0",
"input": {
"terms": [
{
"value": "1",
"unit": "KiB"
},
{
"value": "512",
"unit": "B"
}
],
"to": "B"
}
}
HTTP (no key)
curl -X POST https://computefirst.net/v1/tools/bytesize-add/versions/1.0.0/execute \
-H "Content-Type: application/json" \
-d '{"terms":[{"value":"1","unit":"KiB"},{"value":"512","unit":"B"}],"to":"B"}'
The machine-readable contract is at /v1/tools/bytesize-add/versions/1.0.0.
CLI
node cli.mjs run bytesize-add 1.0.0 --input input.json --base-url https://computefirst.net
Get the client at /clients/cli/.
Related tools
- Byte size compare: Compare two non-negative integer byte sizes by exact byte amounts.
- Byte size convert: Convert a non-negative integer byte size between IEC binary units as an exact rational.
- Length add: Add integer length terms in mixed units and return the exact sum in a chosen unit.
- Mass add: Add mixed-unit canonical integer mass amounts and express the sum in a target unit as a reduced rational.
- Length compare: Compare two integer length measurements by exact nanometer amounts.
- Length convert: Convert a canonical integer length between exact SI and international customary units.