New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

labelstudio-js-client

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

labelstudio-js-client

Small JavaScript client for the custom LabelStudio service

latest
Source
npmnpm
Version
0.2.3
Version published
Maintainers
1
Created
Source

LabelStudio JS Client

Small JavaScript client for your custom LabelStudio service.

Install

npm i labelstudio-js-client

Quick Start

import LabelStudio from 'labelstudio-js-client';

await LabelStudio.configure({
  baseUrl: 'http://localhost:3966',
  preferredPrinters: ['DYMO LabelWriter 450', 'DYMO']
}).init();

const printers = await LabelStudio.getPrinters();
LabelStudio.setPrinter(printers[0]);
LabelStudio.setLabel('dymo.address.30252');

const label = new LabelStudio.Label();
label
  .addText('Order #100045', {
    left: 60,
    top: 70,
    width: 500,
    height: 80,
    fontSize: 40,
    textAlign: 'left',
    autoFit: false
  }).done()
  .addText('Property of SecureErase, LLC', {
    left: 150,
    top: 220,
    width: 540,
    height: 70
  }).align('center').autoFit(true, { width: 540, height: 70 }).done()
  .addBarcode('0192-XY-445901').dimensions(780, 190).at(55, 130).done()
  .addQrCode('https://example.com/track/INV-100045').size(240).at(40, 20).done();

await LabelStudio.print(label, { copies: 2 });

API

  • LabelStudio.configure(options)
  • LabelStudio.init()
  • LabelStudio.getPrinters()
  • LabelStudio.getLabels()
  • LabelStudio.setPrinter(name)
  • LabelStudio.setLabel(labelId)
  • LabelStudio.print(labelOrDesign, options?)
  • LabelStudio.printBulk(labelsOrDesigns, options?)
  • LabelStudio.renderTemplate(template, data)
  • LabelStudio.convertJsonToJs(payload, options?)
  • new LabelStudio.Label()

new LabelStudio.Lable() is also supported as an alias.

Builder Methods

Element builder methods work for text/barcode/qr/image and return to label with .done():

  • .at(left, top)
  • .size(value)
  • .dimensions(width, height)
  • .scale(x, y?)
  • .color(fill)
  • .font(family)
  • .weight(fontWeight)
  • .align('left' | 'center' | 'right')
  • .autoFit(enabled, { width?, height? })
  • .options(object)

Label methods:

  • addText(text, options?)
  • addBarcode(data, options?)
  • addQrCode(data, options?)
  • addImage(src, options?)
  • addObject(object)
  • toJSON()

JSON to JS Converter

Convert a JSON payload into builder-style JavaScript:

const payload = {
  printer: 'DYMO LabelWriter 450',
  label: 'dymo.address.30252',
  objects: [
    {
      type: 'textbox',
      text: 'Order #100045',
      left: 60,
      top: 70,
      width: 500,
      height: 80,
      fontSize: 40,
      textAlign: 'left',
      autoFit: false
    },
    { type: 'barcode', barcodeType: 'code128', barcodeData: '0192-XY-445901', left: 55, top: 130 }
  ]
};

const code = LabelStudio.convertJsonToJs(payload, { includePrintCall: true });
console.log(code);

Error Handling

Common failure cases now throw explicit errors:

  • ServiceUnavailableError: backend service is not reachable.
  • DiscoveryError with code NO_PRINTERS: no printers discovered.
  • DiscoveryError with code NO_LABELS: no labels discovered.

Keywords

label

FAQs

Package last updated on 19 Feb 2026

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