{"_id":"@bejiihiu/telegram-export-minifier","name":"@bejiihiu/telegram-export-minifier","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@bejiihiu/telegram-export-minifier","version":"1.0.0","description":"Compress Telegram Desktop JSON exports into clean markdown","module":"src/index.ts","type":"module","bin":{"tg-minify":"src/cli/index.ts"},"scripts":{"start":"bun run src/cli/index.ts","typecheck":"bunx tsc --noEmit","release:patch":"npm version patch && git push --tags","release:minor":"npm version minor && git push --tags","release:major":"npm version major && git push --tags"},"keywords":["telegram","export","minifier","markdown","converter","json"],"repository":{"type":"git","url":"git+https://github.com/bejiihiu/telegram-export-minifier.git"},"bugs":{"url":"https://github.com/bejiihiu/telegram-export-minifier/issues"},"homepage":"https://github.com/bejiihiu/telegram-export-minifier#readme","license":"MIT","publishConfig":{"registry":"https://registry.npmjs.org"},"devDependencies":{"@types/bun":"latest"},"peerDependencies":{"typescript":"^5"},"_id":"@bejiihiu/telegram-export-minifier@1.0.0","gitHead":"4e842d1e43539646e2c7586b605edc2007253c42","_nodeVersion":"24.2.0","_npmVersion":"11.3.0","dist":{"integrity":"sha512-okYUhmfLfkSMVua41czk0Iyz/3gzM7+KiIX4X7IrTdowxid0fyg9Lq/sc4QaL0cTyexLIGNRN9XMiBzHXX40XA==","shasum":"09996b53f9f3095c59277a37e5badcf928bfde5a","tarball":"https://registry.npmjs.org/@bejiihiu/telegram-export-minifier/-/telegram-export-minifier-1.0.0.tgz","fileCount":28,"unpackedSize":66848,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIAM3jTPsQw9kBFR+SqaRbDW1Du8vJyZ/MsiqUmgrz+jRAiBI2uu9H4JULduHlxTDAHf1w+IVz98+YGkuu8ceQ2DCjA=="}]},"_npmUser":{"name":"bejiihiu","email":"bejiihiu@icloud.com"},"directories":{},"maintainers":[{"name":"bejiihiu","email":"bejiihiu@icloud.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/telegram-export-minifier_1.0.0_1785494828885_0.45400541175784515"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-31T10:47:08.737Z","1.0.0":"2026-07-31T10:47:09.011Z","modified":"2026-07-31T10:47:09.241Z"},"maintainers":[{"name":"bejiihiu","email":"bejiihiu@icloud.com"}],"description":"Compress Telegram Desktop JSON exports into clean markdown","homepage":"https://github.com/bejiihiu/telegram-export-minifier#readme","keywords":["telegram","export","minifier","markdown","converter","json"],"repository":{"type":"git","url":"git+https://github.com/bejiihiu/telegram-export-minifier.git"},"bugs":{"url":"https://github.com/bejiihiu/telegram-export-minifier/issues"},"license":"MIT","readme":"# @bejiihiu/telegram-export-minifier\r\n\r\n[![Bun](https://img.shields.io/badge/Bun-1.0+-ff6b35?logo=bun&logoColor=white)](https://bun.sh)\r\n[![TypeScript](https://img.shields.io/badge/TypeScript-5.x-3178c6?logo=typescript&logoColor=white)](https://www.typescriptlang.org)\r\n[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](./LICENSE)\r\n\r\nCompress Telegram Desktop JSON exports into clean, minimal markdown.\r\n\r\n```\r\n1.2 MB JSON  →  314 KB markdown  (74% smaller)\r\n1129 messages →  216 long posts   (--long-posts)\r\n```\r\n\r\n---\r\n\r\n## Why\r\n\r\nTelegram Desktop's JSON export contains ~30 fields per message. Most of them are useless — file paths, thumbnail sizes, MIME types, message IDs.\r\n\r\nThis tool strips everything except what matters: **dates, text, reactions, and context**.\r\n\r\n## Quick Start\r\n\r\n### 1. Export from Telegram Desktop\r\n\r\n```\r\nChat → Export Telegram data → JSON format\r\n```\r\n\r\nThis gives you `result.json` in a `ChatExport_*` folder.\r\n\r\n### 2. Run the minifier\r\n\r\n```bash\r\n# Install\r\nbun install @bejiihiu/telegram-export-minifier\r\n\r\n# Or run directly\r\nbunx @bejiihiu/telegram-export-minifier result.json -o channel.md\r\n```\r\n\r\n### 3. Use the output\r\n\r\nThe output `channel.md` is a clean markdown file with your posts, ready for analysis, archiving, or any other purpose.\r\n\r\n## Install\r\n\r\n```bash\r\n# With bun\r\nbun install @bejiihiu/telegram-export-minifier\r\n\r\n# With npm\r\nnpm install @bejiihiu/telegram-export-minifier\r\n\r\n# With yarn\r\nyarn add @bejiihiu/telegram-export-minifier\r\n\r\n# With pnpm\r\npnpm add @bejiihiu/telegram-export-minifier\r\n```\r\n\r\nOr run directly without installing:\r\n\r\n```bash\r\nbunx @bejiihiu/telegram-export-minifier result.json\r\nnpx @bejiihiu/telegram-export-minifier result.json\r\n```\r\n\r\n## Usage\r\n\r\n```bash\r\n# Basic conversion\r\ntg-minify result.json -o channel.md\r\n\r\n# Text messages only (skip stickers, videos, audio)\r\ntg-minify result.json --text-only -o channel.md\r\n\r\n# Only long posts (≥200 characters)\r\ntg-minify result.json --long-posts -o channel.md\r\n\r\n# Custom minimum length\r\ntg-minify result.json --min-length 500 -o channel.md\r\n\r\n# Clean output without reactions or service messages\r\ntg-minify result.json --no-reactions --no-service -o channel.md\r\n\r\n# Last 100 messages only\r\ntg-minify result.json --max-messages 100 -o channel.md\r\n\r\n# Only long posts with text\r\ntg-minify result.json --text-only --long-posts --no-reactions -o long-posts.md\r\n```\r\n\r\n## CLI Options\r\n\r\n| Flag | Description | Default |\r\n|------|-------------|---------|\r\n| `--text-only` | Skip all media messages (stickers, video, audio, voice, gif) | `false` |\r\n| `--min-length <n>` | Only include messages with ≥n characters | `0` |\r\n| `--long-posts` | Only long posts (shorthand for `--min-length 200`) | `false` |\r\n| `--no-reactions` | Hide reaction counts from headers | `false` |\r\n| `--no-service` | Hide service messages (pin, create channel, etc.) | `false` |\r\n| `--no-forwarded` | Hide \"forwarded from\" labels | `false` |\r\n| `--no-compress` | Don't strip trailing whitespace or collapse blank lines | `false` |\r\n| `--strip-emoji` | Remove emoji characters from text | `false` |\r\n| `--max-messages <n>` | Process only first N messages | `null` (all) |\r\n| `-o, --output <file>` | Write to file instead of stdout | stdout |\r\n| `-h, --help` | Show help | — |\r\n\r\nSee [docs/CLI-REFERENCE.md](docs/CLI-REFERENCE.md) for detailed descriptions.\r\n\r\n## Output Format\r\n\r\n```markdown\r\n# channel name\r\n\r\n> channel type: public_channel\r\n\r\n[2025-09-20 16:22] (❤ 4)\r\n\r\nText of the message with **bold** and *italic* preserved...\r\n\r\n[2025-09-21 23:54] (video 17s)\r\n\r\n[2025-09-23 00:34] (→ another_channel)\r\n\r\nCaption of forwarded post...\r\n\r\n[2025-09-20 16:45] (sticker: ❤️)\r\n\r\n[2025-09-20 17:32] (reply:42)\r\n\r\nReply text...\r\n\r\n---\r\n*516 messages*\r\n```\r\n\r\n### Metadata tags\r\n\r\n| Tag | Meaning |\r\n|-----|---------|\r\n| `❤ 4` | Reactions: emoji + count |\r\n| `→ channel_name` | Forwarded from another channel |\r\n| `reply:42` | Reply to message ID 42 |\r\n| `[video 17s]` | Video message with duration |\r\n| `[audio 163s]` | Audio message with duration |\r\n| `[sticker: ❤️]` | Sticker with emoji |\r\n| `[voice 46s]` | Voice message |\r\n| `[gif 2s]` | Animation |\r\n| `(service: pinned message)` | Service message |\r\n\r\n### Markdown Mapping\r\n\r\n| Telegram Entity | Markdown Output |\r\n|----------------|-----------------|\r\n| bold | `**text**` |\r\n| italic | `*text*` |\r\n| code | `` `code` `` |\r\n| pre (code block) | ` ``` code ``` ` |\r\n| text_link | `[text](url)` |\r\n| spoiler | `\\|\\|text\\|\\|` |\r\n| strikethrough | `~~text~~` |\r\n| underline | `__text__` |\r\n| blockquote | `> text` |\r\n| custom_emoji | `[emoji]` |\r\n| mention | `@text` |\r\n\r\n## Programmatic Usage\r\n\r\n```typescript\r\nimport {\r\n  ExportParser,\r\n  Pipeline,\r\n  mergeOptions,\r\n  MarkdownFormatter,\r\n} from '@bejiihiu/telegram-export-minifier'\r\n\r\n// Parse export file\r\nconst data = ExportParser.fromFile('result.json')\r\n\r\n// Or parse from string\r\nconst data = ExportParser.fromString(jsonString)\r\n\r\n// Create pipeline with options\r\nconst pipeline = new Pipeline(mergeOptions({\r\n  textOnly: true,\r\n  minLength: 100,\r\n  includeReactions: true,\r\n  includeService: false,\r\n}))\r\n\r\n// Run conversion\r\nconst { markdown, stats } = pipeline.run(data)\r\n\r\nconsole.log(`${stats.totalMessages} messages → ${stats.outputLines} lines`)\r\nconsole.log(`${stats.outputSize} bytes`)\r\n\r\n// Write output\r\nawait Bun.write('output.md', markdown)\r\n```\r\n\r\nSee [docs/API-REFERENCE.md](docs/API-REFERENCE.md) for full API documentation.\r\n\r\n## Documentation\r\n\r\n- [Getting Started](docs/GETTING-STARTED.md) — step-by-step guide\r\n- [CLI Reference](docs/CLI-REFERENCE.md) — all command-line options\r\n- [API Reference](docs/API-REFERENCE.md) — programmatic interface\r\n- [Architecture](docs/ARCHITECTURE.md) — project structure and design\r\n- [Examples](docs/EXAMPLES.md) — common use cases\r\n- [Telegram Schema](docs/TELEGRAM-SCHEMA.md) — export format documentation\r\n\r\n## Project Structure\r\n\r\n```\r\nsrc/\r\n├── types/\r\n│   ├── telegram.ts        # Telegram export types\r\n│   ├── options.ts         # MinifyOptions + defaults\r\n│   └── index.ts           # Re-exports\r\n├── core/\r\n│   ├── parser.ts          # JSON loading & validation\r\n│   ├── message-filter.ts  # Message filtering logic\r\n│   └── index.ts\r\n├── formatters/\r\n│   ├── date.ts            # Date → YYYY-MM-DD HH:MM\r\n│   ├── markdown.ts        # TextEntity → markdown\r\n│   ├── media.ts           # Media type → [label]\r\n│   ├── metadata.ts        # Reactions, forwarded, reply\r\n│   ├── service.ts         # Service message formatting\r\n│   ├── text-extractor.ts  # Extract text from message\r\n│   └── index.ts\r\n├── pipeline/\r\n│   ├── pipeline.ts        # Orchestrates the whole flow\r\n│   └── index.ts\r\n├── cli/\r\n│   ├── args.ts            # CLI argument parsing\r\n│   └── index.ts           # CLI entry point\r\n└── index.ts               # Public API exports\r\n```\r\n\r\n## Requirements\r\n\r\n- [Bun](https://bun.sh) ≥ 1.0 or [Node.js](https://nodejs.org) ≥ 18\r\n- [TypeScript](https://www.typescriptlang.org) ≥ 5.0\r\n\r\n## Contributing\r\n\r\nSee [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.\r\n\r\n## License\r\n\r\n[MIT](LICENSE)\r\n","readmeFilename":"README.md","_rev":"1-04a2f243ad44f131d6ccc7b2060b40d8"}