@scalenc/lst-format
TypeScript icon, indicating that this package has built-in type declarations

1.3.10 • Public • Published

TRUMPF LST file format library

License NPM version

This is a typescript library to read and write the TRUMPF LST file format.

It comes with a plain class model of the LST file structure and a persistency layer to read this model from a string.

Installation

npm install @scalenc/lst-format
yarn add @scalenc/lst-format
pnpm add @scalenc/lst-format

Examples

Sample usage to read TRUMPF LST file

import { Reader } from '@scalenc/lst-format';

const lst = `BD
SET_METRIC
BEGIN_FERTIGUNG_AUFTRAG_TMP
ZA,MM,6
MM,AT,1,  10,1,1,,'Jobname'                           ,,'',T
MM,AT,1,  50,1,1,,'SollAnzahl'                        ,,'',Z
ZA,DA,1
DA,'JOB43',1
ENDE_FERTIGUNG_AUFTRAG_TMP
ED`;
const docs = new Reader(lst).read().documents;

Sample usage to construct and write TRUMPF LST file

import { DocumentBuilder, Writer } from '@scalenc/lst-format';

const doc = new DocumentBuilder().table('FERTIGUNG_AUFTRAG_TMP', (t) => t.text(10, 'Jobname').num(50, 'SollAnzahl').data(['JOB43', 1])).document;
const out = new Writer().writeDocument(doc);
console.log(out);

Sample using convenience access layer to standard tables via reflection

import { newDocument, Reader, Tables } from '@scalenc/lst-format';

const lst = `BD
SET_METRIC
BEGIN_FERTIGUNG_AUFTRAG_TMP
ZA,MM,6
MM,AT,1,  10,1,1,,'Jobname'                           ,,'',T
MM,AT,1,  50,1,1,,'SollAnzahl'                        ,,'',Z
ZA,DA,1
DA,'JOB43',1
ENDE_FERTIGUNG_AUFTRAG_TMP
ED`;
const docs = new Reader(lst).read().documents;
const doc = newDocument(Tables.Document, docs[0]);
console.log(doc.productionOrders[0].jobName);

Development

Run yarn to setup project and install all dependencies.

Run yarn test to run all tests.

Run yarn lint to check for linting issues.

Run yarn build to build.

License

All rights reserved to ScaleNC GmbH.

Source Code and Binaries licensed under BSD-3-Clause.

Package Sidebar

Install

npm i @scalenc/lst-format

Weekly Downloads

73

Version

1.3.10

License

BSD-3-CLAUSE

Unpacked Size

227 kB

Total Files

111

Last publish

Collaborators

  • daniel.scalenc
  • stephan.scalenc