installedBytes method

Future<int> installedBytes(
  1. SyniModelSpec spec
)

Total on-disk bytes occupied by spec's model files (the GGUF plus its sibling tokenizer.json). Returns 0 when nothing is installed. Useful for telling the user how much storage a delete will reclaim.

Implementation

Future<int> installedBytes(SyniModelSpec spec) async {
  final dir = await _modelsDir();
  var total = 0;
  for (final file in [
    File('${dir.path}/${spec.filename}'),
    File('${dir.path}/tokenizer.json'),
  ]) {
    if (file.existsSync()) {
      try {
        total += file.lengthSync();
      } catch (_) {}
    }
  }
  return total;
}