Skip to content

Instantly share code, notes, and snippets.

@eiiot

eiiot/upload.ts Secret

Last active June 17, 2025 20:08
Show Gist options
  • Select an option

  • Save eiiot/fce125a1f69e0bfac4a1d0c99a780b1f to your computer and use it in GitHub Desktop.

Select an option

Save eiiot/fce125a1f69e0bfac4a1d0c99a780b1f to your computer and use it in GitHub Desktop.
import AtpAgent from "@atproto/api";
const agent = new AtpAgent({
service: "https://bsky.social",
});
await agent.login({
identifier: "eliot.sh",
password: "YOUR_APP_PASSWORD",
});
// create a string of length 1mb
const longString = "a".repeat(1024 * 1024); // 1 MB of 'a's
const assetUploadResponse = await agent.com.atproto.repo.uploadBlob(longString);
console.log("Asset upload response:", assetUploadResponse);
// error: request entity too large
// error: "PayloadTooLargeError",
// headers: {
// "access-control-allow-origin": "*",
// "alt-svc": "h3=\":443\"; ma=2592000",
// "cache-control": "private",
// "content-length": "69",
// "content-type": "application/json; charset=utf-8",
// date: "Tue, 17 Jun 2025 19:56:45 GMT",
// etag: "W/\"45-fSA/Bp81/oC4/RTIFR0WOeq6n7k\"",
// vary: "Authorization, Accept-Encoding",
// via: "1.1 Caddy",
// "x-powered-by": "Express",
//},
// success: false,
// status: 413,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment