# Zip.List — what an archive holds

> `Zip.List(bytes)` answers the names a ZIP archive holds, in archive order — read from its central directory only, so nothing is decompressed and an archive built to expand to gigabytes costs exactly its own size. Bytes that are not a readable ZIP answer an empty list.

<!-- id: stdlib-zip · area: stdlib · stability: preview · html: https://osysharp.com/reference/stdlib/zip/ -->

## Summary        {#summary}
A customer attaches `logs.zip`; the desk wants to see what is in it before saving it anywhere:

```osy syntax
foreach (var name in Zip.List(File.ReadAllBytes(attached.File))) { … }   // "logs/", "logs/app.log", "config.json"
```

## Signature      {#signature}
```osy syntax
List<string> Zip.List(byte[] archive)   // entry names in archive order; a folder's own entry ends in "/"
```

## Description    {#description}
**Only the directory is read.** The listing comes from the archive's central directory; no entry is opened, so the
call is as cheap and as safe for a hostile archive as for an honest one. It answers at most **1000** names.

**Not an archive is an answer, not a fault.** Bytes that are not a readable ZIP — a renamed file, a truncated
download — answer an empty list, which a page shows as "this archive could not be read" rather than as an error in
the code that asked.

It runs on the server: the bytes are a `byte[]`, which a page has no representation of, so a page is sent the listing.

## Examples       {#examples}

```osy title="list an archive, folders first" test app=stdlib-zip
List<string> Folders(byte[] archive) {
  return Zip.List(archive).Where(n => n.EndsWith("/")).ToList();
}

int FileCount(byte[] archive) {
  return Zip.List(archive).Count(n => !n.EndsWith("/"));
}
```

## See also       {#see-also}
- [The Conversations kit — one timeline per conversation, across every channel](https://osysharp.com/reference/ui/conversations-kit/) — a ZIP attached to a message is listed on the timeline with this
- [[Attachment] — a file readable wherever its row is](https://osysharp.com/reference/storage/attachment/) — reading an attached file's bytes
- [Mail on the wire — Mime.Parse, Mime.Build, Imap.Fetch, Smtp.Send](https://osysharp.com/reference/stdlib/mail-wire/) — the mail an archive usually arrives in
