content-share (content sharing engine)
About 1 min
content-share
❝ One provider engine, one shared path from content to URL. ❞
What it is
A base library that uploads text, images or files to paste bins, image hosts, object storage or note archives and hands back a shareable URL. The package stops at the URL — QR codes, clipboard writes and OS share sheets belong to the caller.
Used by aiti-msg-share as its sharing engine.
Why it
- 161 built-in targets: the full ShareX CustomUploaders catalog (148
.sxcuconfigs, synced upstream) plus 7 China-friendly services, 5 note archives and 2 code providers. - Data-driven: an
.sxcuconfig is a provider — add a target without writing code; one engine executes them all (4 body types, ShareX syntax parser port, JSONPath/regex URL extraction). - Runtime registration:
registry.register()/addEntry()for user-defined or remotely delivered targets. - Remote catalog overlay: recommended set, dead-service flags and new entries maintained at a central JSON URL (disk cache + TTL + stale fallback).
- Redaction hook:
share()acceptshooks.transformText, so callers can inject a secrets scanner (e.g.@aiti-ai/secret-mask-core). The package has no opinion on content. - Zero runtime dependencies, Node >= 22.18.
Usage
import { Registry, share } from "@aiti-ai/content-share";
const registry = new Registry();
await registry.init(); // loads the 161-entry catalog
const result = await share(
registry.get("gitee-gist")!,
{ text: "# Hello" },
{ provider: "gitee-gist", values: { token: process.env.GITEE_TOKEN! } },
);
console.log(result.url); // terminal outputCLI:
content-share list [text|image|file] # list targets by content kind
content-share share --provider <id> --text hi # upload and print the URL
content-share import-sxcu <file.sxcu> # validate a config's compatibility
content-share mock paste-demo --port 8931 # start the demo paste serverCategories
publish (public URL) · archive (Joplin/Obsidian deep links) · bookmark · local (local session links).
License
MIT. The .sxcu syntax semantics are derived from ShareX (GPL v3) by independent reimplementation — no ShareX source code is included.