One item in a list of a bucket or folder, either a file or a folder.

One item from space.fs.list(): either a File or a folder. Check type to tell them apart, and TypeScript then knows which fields the entry has.

[
  { "type": "folder", "prefix": "2026/03/", "size": 96426 },
  {
    "type": "file",
    "bucket": "01m3c081d2wj4g63qcr53pa1yh",
    "key": "2026/0001.pdf",
    "size": 48213,
    "contentType": "application/pdf",
    "etag": "5d41402abc4b2a76b9719d911017c592",
    "createdAt": "2026-09-26T09:30:00Z",
    "updatedAt": "2026-09-26T09:30:00Z"
  }
]
entries.ts
import { space } from "digitospace"

for await (const entry of space.fs.list("invoices/2026")) {
  if (entry.type === "folder") {
    console.log(entry.prefix)
  } else {
    console.log(entry.key, entry.contentType)
  }
}

Fields

An entry with type set to file has every field of a File. An entry with type set to folder, which the package calls Folder, has these:

typestringRequired

Always folder.

prefixstringRequired

The folder’s key, ending in /, such as 2026/03/. Every file inside it has a key that starts with this.

sizenumber

In a list of one level, the size in bytes of every file inside the folder. Missing from the folder that space.fs.mkdir() gives back.

A list with recursive: true has no folder entries, only files.

Returned by

Last updated