Latest Threat ResearchGlassWorm Loader Hits Open VSX via Developer Account Compromise.Details
Socket
Book a DemoInstallSign in
Socket

taro-bluetooth-print

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

taro-bluetooth-print

Taro 蓝牙打印库 v2.0 - 轻量级、高性能、跨平台

npmnpm
Version
2.0.2
Version published
Weekly downloads
24
4.35%
Maintainers
1
Weekly downloads
 
Created
Source

Taro Bluetooth Print

A lightweight, high-performance Bluetooth printing library for Taro, designed for simplicity and ease of use.

Features

  • Simple API: Fluent interface for building print commands.
  • Cross-Platform: Built on top of Taro's Bluetooth API, works on Weapp, H5, RN, etc.
  • High Performance: Direct byte buffer manipulation.
  • Rich Support: Text, Images, Barcodes (coming soon), QR Codes (coming soon).
  • Extensible: Modular driver architecture (ESC/POS included).

Installation

npm install taro-bluetooth-print
# or
yarn add taro-bluetooth-print

Usage

Basic Example

import { BluetoothPrinter } from 'taro-bluetooth-print';

const printer = new BluetoothPrinter();

async function printReceipt(deviceId: string) {
  try {
    await printer.connect(deviceId);

    await printer
      .text('Hello World!')
      .feed()
      .text('This is a test print.')
      .feed(2)
      .cut()
      .print();
      
    console.log('Print success');
  } catch (error) {
    console.error('Print failed', error);
  } finally {
    await printer.disconnect();
  }
}

Printing Images

// Assuming you have pixel data (RGBA) from a canvas or image
const imageData = new Uint8Array([...]); 
const width = 200;
const height = 100;

await printer
  .text('Image Print:')
  .feed()
  .image(imageData, width, height)
  .feed(2)
  .print();

API Reference

BluetoothPrinter

  • connect(deviceId: string): Promise<this>
  • disconnect(): Promise<void>
  • text(content: string, encoding?: string): this
  • feed(lines?: number): this
  • cut(): this
  • image(data: Uint8Array, width: number, height: number): this
  • print(): Promise<void>

License

MIT

Keywords

taro

FAQs

Package last updated on 21 Nov 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts