> For the complete documentation index, see [llms.txt](https://docs.file0.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.file0.dev/sdk/download.md).

# Download

```typescript
import { f0 } from "file0";
import { Readable } from "stream";
import fs from "fs";

// Get file metadata (name, size, public url, etc..)
const metadata = await f0.get("logs.txt");

// Download a text file
const text = await f0.get("hello.txt", { as: "text" });

// Download a json object
const obj = await f0.get("data.json", { as: "json" });

// Download as a stream and save to the file system
const fileStream = await f0.get("logs.txt", { as: "stream"});
Readable
  .fromWeb(fileStream)
  .pipe(fs.createWriteStream("./logs.txt"));

// Download as a buffer
const file = await f0.get("image.png", { as: "buffer" });
// returns the web-compatible ArrayBuffer
// To convert it to a Node.js Buffer:
const nodejsBuffer = Buffer.from(file);
```
