Getting started
Fetch a URL as markdown from your own code on Node or Bun
furl-core is the engine behind the furl CLI, packaged as an Effect library. Give it a URL and it walks the same resolver chain, returning markdown from the first resolver that can produce it. Use it when your agent or app needs that in-process instead of shelling out to furl.
Requirements
- ESM: load it with
import, notrequire. - Node 20 or newer, or Bun.
- Effect v4, 4.1.0 or newer.
Install
npm install furl-core effectpnpm add furl-core effectyarn add furl-core effectbun add furl-core effectnub add furl-core effectaube add furl-core effecteffect is a peer dependency, so your app and furl-core share one Effect runtime.
First fetch
import { Furl } from 'furl-core';
import { Effect } from 'effect';
import { FetchHttpClient } from 'effect/http';
const result = await Effect.runPromise(
Furl.fetch('https://bun.sh/docs.md').pipe(Effect.provide(FetchHttpClient.layer)),
);
console.log(result.source);
console.log(result.markdown.split('\n')[0]);
Output:
raw
# Welcome to Bun
furl uses whatever HttpClient you provide, so your app’s tracing, retries or proxy apply to its requests. FetchHttpClient is the one that uses the runtime’s global fetch. Without Furl.layer, Furl.fetch runs the three keyless Resolvers.defaults.
To run a different list of resolvers or add a provider such as jina, see Resolvers.
The result
Furl.fetch succeeds with { markdown, source }:
| Field | Meaning |
|---|---|
markdown |
The page as markdown |
source |
The id of the resolver that produced it, such as raw |
What it won’t do
The default resolvers succeed on URLs that already serve markdown or a plain file. For a page that serves only HTML, the fetch fails with AllResolversFailed; add a provider such as jina to parse those, as shown on Resolvers.