Skip to content

Instantly share code, notes, and snippets.

@furrz
Last active June 17, 2025 04:38
Show Gist options
  • Select an option

  • Save furrz/1211664ff38bf16fda08f73f2cbce7f8 to your computer and use it in GitHub Desktop.

Select an option

Save furrz/1211664ff38bf16fda08f73f2cbce7f8 to your computer and use it in GitHub Desktop.
bsky-follower-download (NodeJS + TypeScript)

How to use

  1. Make sure you have Node.JS installed.
  2. Create a folder
  3. Add tsconfig.json and package.json to that folder.
  4. Add index.mts to a src folder beneath it.
  5. Edit the fourth line of index.mts to contain your bluesky handle, excluding the @ sign.
  6. Open a terminal in the main folder.
  7. Run npm install
  8. Run npm run build
  9. Run node .
  10. A file called followers.csv should now exist. Use it.
import { AtpAgent } from "@atproto/api";
import { createWriteStream } from "fs";
const username = "zyntaks.ca"
export const agent = new AtpAgent({
service: "https://api.bsky.app",
});
const csvEscape = (str: string) =>
`"${str.replace(/"/g, '""')}"`;
const outStream = createWriteStream("followers.csv")
let cursor: string | undefined = ""
while (cursor != undefined) {
const result = await agent.app.bsky.graph.getFollowers({ actor: username, cursor });
for (let follower of result.data.followers) {
outStream.write(csvEscape(follower.handle ?? "null"))
outStream.write(",")
outStream.write(csvEscape(follower.displayName ?? "null"))
outStream.write(",")
outStream.write(csvEscape(follower.description ?? "null"))
outStream.write("\r\n")
}
cursor = result.data.cursor;
}
outStream.close();
{
"name": "bsky-follower-download",
"version": "1.0.0",
"description": "",
"main": "dist/index.mjs",
"scripts": {
"build": "tsc"
},
"dependencies": {
"@atproto/api": "^0.15.15"
},
"devDependencies": {
"@types/node": "^24.0.3",
"typescript": "^5.5.3"
},
"private": true
}
{
"compilerOptions": {
"target": "es2017",
"module": "Node16",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true,
"outDir": "dist"
},
"include": ["src"]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment