Skip to main content
// Get file from default branch
const resp = await repo.getFileStream({ path: "README.md" });
const text = await resp.text();
console.log(text);

// Get file from specific branch, tag, or commit
const historicalResp = await repo.getFileStream({
  path: "package.json",
  ref: "v1.0.0", // branch name, tag, or commit SHA
});
const historicalText = await historicalResp.text();

// Fetch from the ephemeral namespace
const ephemeralResp = await repo.getFileStream({
  path: "notes.md",
  ref: "feature/demo-work",
  ephemeral: true,
});

Options

path
string
required
Path to the file within the repository
ref
string
Branch name, tag, or commit SHA. Defaults to the default branch.
ephemeral
string
When true, resolves the ref under the ephemeral namespace.
ephemeralBase
string
When true, resolves the base branch under the ephemeral namespace.

Returns

Returns a standard Fetch Response object (TypeScript), an async response object (Python), or an *http.Response (Go) that can be used to stream or read the file content.