Bytes parse human
bytes-parse-human · version 1.0.0 · Other utilities · free, no key needed
Parse an SI or IEC byte-size string and return an exact integer byte count using explicit rounding.
Use when you need to: parse a human file size · turn 1.5 GiB into bytes · convert 300 MB to exact bytes.
Decide before calling
Read the versioned contract and the supported scope below. Reuse bytes-parse-human@1.0.0 when your input, required output and limits match it. Choose another approach for an unsupported operation.
Explain the choice
"I can use bytes-parse-human@1.0.0 for parse a human file size. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."
Supported
- parse a human file size
- turn 1.5 GiB into bytes
- convert 300 MB to exact bytes
- parse 10 kB
- human size to byte count
- read SI or IEC storage size
Not supported
- format a byte count
- parse bit-rate units
Behavior
- Accepted grammar is a canonical non-negative decimal, optional single ASCII space, then B, kB, MB, GB, TB, PB, KiB, MiB, GiB, TiB or PiB.
- SI units use powers of 1000 and IEC units use powers of 1024.
- Fractional bytes use half_even, half_up, or down exactly; no binary floating-point arithmetic is used.
Input
text(string, required): min length 1; max length 128rounding(one of "half_even", "half_up", "down", required)
Output
bytes(string, required): pattern^(0|[1-9][0-9]*)$rounding(one of "half_even", "half_up", "down", required)standard_version(constant "IEC 80000-13:2008; SI Brochure, 9th edition (2019, updated 2022)", required)
Limits
- max input bytes: 128
- max digits: 30
- max output bytes: 512
- max iterations: 0
Example
Request input:
{
"text": "1.5GiB",
"rounding": "half_even"
}
Response:
{
"result": {
"bytes": "1610612736",
"rounding": "half_even",
"standard_version": "IEC 80000-13:2008; SI Brochure, 9th edition (2019, updated 2022)"
}
}
How to call it
MCP
Connect https://computefirst.net/mcp (setup), then call execute with:
{
"id": "bytes-parse-human",
"version": "1.0.0",
"input": {
"text": "1.5GiB",
"rounding": "half_even"
}
}
HTTP (no key)
curl -X POST https://computefirst.net/v1/tools/bytes-parse-human/versions/1.0.0/execute \
-H "Content-Type: application/json" \
-d '{"text":"1.5GiB","rounding":"half_even"}'
The machine-readable contract is at /v1/tools/bytes-parse-human/versions/1.0.0.
CLI
node cli.mjs run bytes-parse-human 1.0.0 --input input.json --base-url https://computefirst.net
Get the client at /clients/cli/.
Related tools
- Bytes format human: Format an exact byte count as both SI and IEC strings and return the rounding mode used.
- Data rate convert: Convert bit or byte rates across SI and IEC prefixes and return an exact reduced rational.
- Base64url decode: Decode base64url to UTF-8 text or lowercase hex and return the requested value.
- Identifier case convert: Convert an ASCII identifier to a requested common case and return the converted identifier.
- Base64url encode: Encode supplied UTF-8 text or hexadecimal bytes as base64url and return the encoded string.
- Epoch to ISO: Convert an exact integer Unix timestamp in seconds, milliseconds, microseconds or nanoseconds to RFC 3339 UTC.