{
  "schemaVersion": 1,
  "slug": "download-time-calculator",
  "category": "productivity",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "7cb4452b953be10ae35d7c10adbfea218313e1561b057b05aefb8c1282dcab5a",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/download-time-calculator.json",
    "src/engine.js"
  ],
  "runtimeSource": "/sources/engine.txt",
  "runtimeHash": "5c888d8898afbdee36267bb9977829e1e2ac568f6677c8ee87469c139864645c",
  "scope": "The compute function records implemented equations, constants, lookup tables and custom rules. Inputs record defaults and allowed values; outputs record precision and units. Defaults are examples, not recommendations. General background references are not evidence for this specific algorithm.",
  "publishedFormula": {
    "formula": "t = S × u × n × 8 ÷ (V × (1 − o ÷ 100))",
    "vars": [
      [
        "S",
        "file size"
      ],
      [
        "u",
        "decimal unit factor to MB"
      ],
      [
        "n",
        "number of files"
      ],
      [
        "V",
        "connection speed, Mbps"
      ],
      [
        "o",
        "overhead, %"
      ],
      [
        "t",
        "download time, seconds"
      ]
    ],
    "note": "Decimal units: GB=1,000 MB, MB=1, TB=1,000,000 MB, kb=1/8,000 MB. Speed is decimal Mbps; ×8 converts MB to megabits."
  },
  "externalEvidence": null,
  "contract": {
    "compute": "const U={GB:1000,MB:1,TB:1000000,kb:1/8000};const totalMb=fileSize*(U[fileUnit]||1)*files;const effectiveSpeed=speed*(1-overhead/100);const seconds=effectiveSpeed>0?totalMb*8/effectiveSpeed:0;const eff=s=>{if(!Number.isFinite(s)||s<=0)return'—';const total=Math.round(s);if(total<60)return s.toFixed(1)+' seconds';if(total<3600)return Math.floor(total/60)+' min '+(total%60)+' s';return Math.floor(total/3600)+' h '+Math.floor(total%3600/60)+' min'};return{totalMb,effectiveSpeed,seconds,formatted:eff(seconds),speedMBps:effectiveSpeed/8};",
    "inputs": [
      {
        "name": "fileSize",
        "type": "number",
        "default": 5,
        "min": 0.001,
        "max": 100000,
        "step": 0.1
      },
      {
        "name": "fileUnit",
        "type": "select",
        "default": "GB",
        "options": [
          {
            "value": "GB"
          },
          {
            "value": "MB"
          },
          {
            "value": "TB"
          },
          {
            "value": "kb"
          }
        ]
      },
      {
        "name": "speed",
        "type": "number",
        "default": 100,
        "min": 0.1,
        "max": 100000,
        "step": 0.1
      },
      {
        "name": "overhead",
        "type": "number",
        "default": 8,
        "min": 0,
        "max": 40,
        "step": 1,
        "slider": true
      },
      {
        "name": "files",
        "type": "number",
        "default": 1,
        "min": 1,
        "max": 10000,
        "step": 1
      }
    ],
    "outputs": [
      {
        "name": "formatted",
        "precision": 0,
        "unit": "",
        "type": "text"
      },
      {
        "name": "seconds",
        "precision": 1,
        "unit": "s"
      },
      {
        "name": "totalMb",
        "precision": 1,
        "unit": "MB"
      },
      {
        "name": "effectiveSpeed",
        "precision": 2,
        "unit": "Mbps"
      },
      {
        "name": "speedMBps",
        "precision": 2,
        "unit": "MB/s"
      }
    ],
    "interpret": null
  }
}
