Huakun

LocalSend TypeScript

A TypeScript implementation of the LocalSend protocol for secure, local network file and text transfers

A TypeScript implementation of the LocalSend protocol for secure, local network file and text transfers.

GitHub: https://github.com/CrossCopy/localsend-ts

Features

  • Full Protocol Support: Complete implementation of LocalSend protocol v2
  • Cross-Platform: Works with Node.js, Bun, and Deno
  • Multiple Server Adapters: Bun, Node.js, Deno, and Hono server adapters
  • Interactive TUI: Sophisticated terminal UI built with Ink (React for CLI)
  • Library & CLI: Use as a library or CLI tool
  • Multicast Discovery: Automatic device discovery on local network
  • HTTP Discovery: Alternative HTTP-based discovery method

Installation

# NPM
npm install localsend

# JSR
npx jsr add @crosscopy/localsend

Usage

Library

import {
  BunServerAdapter,
  NodeServerAdapter,
  DenoServerAdapter,
  createServerAdapter,
  LocalSendServer,
  LocalSendHonoServer,
  LocalSendClient,
  MulticastDiscovery,
  HttpDiscovery,
} from "localsend";
# Run the sophisticated TUI with real-time device scanning
npm run tui
# or with Bun
bun src/cli-tui.tsx

# With custom port and alias
npm run tui -- --port 8080 --alias "My Device"

The TUI provides:

  • Real-time device scanning - Continuously discover LocalSend devices
  • Device selection - Navigate and select from discovered devices
  • Send text messages - Interactive text input and sending
  • Send files - File path input with validation
  • Receiver mode - Real-time file receiving with progress
  • Settings - Dynamic device configuration

CLI - Traditional

npx localsend

# Please use a subcommand: send | receive | discover
# Examples:
#   localsend send 192.168.1.100 ./file.txt
#   localsend receive --saveDir ./downloads
#   localsend discover --timeout 10

Development

deno -A --unstable-sloppy-imports --unstable-net src/cli.ts receive -=alias deno-client
bun run src/cli.ts receive

Built for integrating LocalSend into Kunkun.

On this page