Skip to content

Quickstart

Boot the server, write a file, commit it, read it back.

1. Start the server

docker run -p 7860:7860 -e MARKDOWNFS_LISTEN=0.0.0.0:7860 \
  ghcr.io/subramanya1997/markdownfs:latest

2. Write your first file

import { MarkdownFS } from "markdownfs";

const mdfs = new MarkdownFS({ baseUrl: "http://localhost:7860" });

await mdfs.fs.write("notes/idea.md", "# my idea\n");
console.log(await mdfs.fs.read("notes/idea.md"));
from markdownfs import MarkdownFS

mdfs = MarkdownFS(base_url="http://localhost:7860")

mdfs.fs.write("notes/idea.md", "# my idea\n")
print(mdfs.fs.read("notes/idea.md"))
curl -X PUT http://localhost:7860/fs/notes/idea.md \
  --data-binary "# my idea"
curl http://localhost:7860/fs/notes/idea.md

3. Commit it

const { hash } = await mdfs.vcs.commit("first note");
const { commits } = await mdfs.vcs.log();
console.log(commits);
commit = mdfs.vcs.commit("first note")
print(mdfs.vcs.log())

4. Search across files

const hits = await mdfs.search.grep("idea", { recursive: true });
hits = mdfs.search.grep("idea", recursive=True)

Next