npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, πŸ‘‹, I’m Ryan HefnerΒ  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you πŸ™

Β© 2026 – Pkg Stats / Ryan Hefner

dtl-parser

v1.0.0

Published

DTL (Domain Transport Language) Parser - Ultra-compact, cryptographic data transport format. Product of Dubai πŸ‡¦πŸ‡ͺ

Readme

🧬 DTL Parser (JavaScript/TypeScript)


Parser for DTL (Domain Transport Language) - Ultra-compact, schema-driven, cryptographic data transport format for JavaScript and TypeScript.

πŸ“– Specification: dtlaz.org | 🌐 AlifZetta: axz.si

Installation

npm install dtl-parser
# or
yarn add dtl-parser
# or
pnpm add dtl-parser

Quick Start

import { parse, write, createDocument, addTable } from 'dtl-parser';

// Parse DTL content
const doc = parse(`
@dtlv1.0^dtHC^pMedical^c1^s0^w0^h0
@sec^hash^0x0^none^0

PATIENTS|id:s,name:s,age:i|2|S0|W0|C1
P001|John Doe|45
P002|Jane Smith|32
`);

// Access tables
const patients = doc.tables.get('PATIENTS');
console.log(patients?.rows);
// [{ id: 'P001', name: 'John Doe', age: 45 }, ...]

// Create new document
const newDoc = createDocument('dtWEB', 'pAPI');
addTable(newDoc, 'USERS', { id: 's', name: 's', active: 'b' }, [
  { id: 'U001', name: 'Alice', active: true },
  { id: 'U002', name: 'Bob', active: false },
]);

// Write to DTL string
const dtlString = write(newDoc);

React Integration

import { useDTL, useDTLTable, DTLProvider } from 'dtl-parser/react';

// Hook for parsing DTL
function MyComponent() {
  const { doc, parse, error, loading, getRows } = useDTL();
  
  useEffect(() => {
    parse(dtlContent);
  }, []);
  
  if (loading) return <div>Loading...</div>;
  if (error) return <div>Error: {error.message}</div>;
  
  const users = getRows('USERS');
  
  return (
    <ul>
      {users.map(user => (
        <li key={user.id}>{user.name}</li>
      ))}
    </ul>
  );
}

Fetch DTL from URL

import { useDTLFetch } from 'dtl-parser/react';

function DataComponent() {
  const { doc, loading, error, refetch } = useDTLFetch({
    url: 'https://api.example.com/data.dtl',
    refreshInterval: 30000, // Refresh every 30s
  });
  
  if (loading) return <div>Loading...</div>;
  
  return (
    <div>
      <button onClick={refetch}>Refresh</button>
      {/* ... */}
    </div>
  );
}

Table Hook

import { useDTLTable } from 'dtl-parser/react';

interface User {
  id: string;
  name: string;
  active: boolean;
}

function UsersTable({ doc }) {
  const { rows, count, find, filter } = useDTLTable<User>({
    doc,
    tableName: 'USERS',
  });
  
  const activeUsers = filter(u => u.active);
  const admin = find(u => u.id === 'admin');
  
  return (
    <div>
      <p>Total: {count}, Active: {activeUsers.length}</p>
      {/* ... */}
    </div>
  );
}

Format Converters

import { fromJSON, toJSON, fromCSV, toCSV, fromXML, toXML } from 'dtl-parser/converters';

// JSON β†’ DTL
const doc = fromJSON({
  users: [
    { id: 1, name: 'Alice' },
    { id: 2, name: 'Bob' },
  ],
});

// DTL β†’ JSON
const jsonStr = toJSON(doc);

// CSV β†’ DTL
const csvDoc = fromCSV(`id,name,score
1,Alice,95
2,Bob,87`, { tableName: 'STUDENTS' });

// DTL β†’ CSV
const csvStr = toCSV(doc, 'USERS');

// XML β†’ DTL
const xmlDoc = fromXML('<users><user id="1">Alice</user></users>');

// DTL β†’ XML
const xmlStr = toXML(doc);

Auto-detect Format

import { convertToDTL, convertFromDTL } from 'dtl-parser/converters';

// Auto-detect and convert
const doc1 = convertToDTL('{"data": [1,2,3]}');        // Detects JSON
const doc2 = convertToDTL('id,name\n1,Alice');         // Detects CSV
const doc3 = convertToDTL('<data>...</data>');         // Detects XML
const doc4 = convertToDTL('@dtlv1.0^dtWEB^...');       // Detects DTL

// Convert DTL to any format
const json = convertFromDTL(doc, 'json');
const csv = convertFromDTL(doc, 'csv');
const xml = convertFromDTL(doc, 'xml');

API Reference

Core Functions

| Function | Description | |----------|-------------| | parse(content) | Parse DTL string to document | | write(doc) | Write document to DTL string | | createDocument(domain, profile) | Create new empty document | | addTable(doc, name, schema, rows) | Add table to document | | getTable(doc, name) | Get table by name | | getRows(doc, tableName) | Get table rows as array | | getConfig(doc, key) | Get config value |

Types

interface DTLDocument {
  header: DTLHeader;
  security: DTLSecurityHeader;
  tables: Map<string, DTLTable>;
  raw: string;
}

interface DTLTable {
  name: string;
  schema: Record<string, string>;
  fieldOrder: string[];
  rows: Record<string, any>[];
  rowCount: number;
  securityMode: string;
  web3Mode: string;
}

interface DTLHeader {
  version: string;
  domain: string;
  profile: string;
  compression: string;
  security: string;
  web3: string;
  checksum: string;
}

DTL Types

| Type | JavaScript | Description | |------|------------|-------------| | s | string | String | | i | number | Integer | | f | number | Float | | b | boolean | Boolean (0/1) | | D | Date | Date | | T | Date | Timestamp | | j | object | JSON | | a(s) | string[] | Array |

DTL Format

@dtlv1.0^{domain}^{profile}^{compression}^{security}^{web3}^{checksum}
@sec^{hash}^{wallet}^{signature}^{chainId}

TABLE_NAME|field:type,field:type|rowcount|S|W|C
value1|value2|value3
value1|value2|value3

Example

@dtlv1.0^dtHC^pMedical^c1^s0^w0^abc123
@sec^hash123^0x0^none^0

PATIENTS|id:s,name:s,dob:D,active:b|3|S0|W0|C1
P001|John Doe|1980-05-15|1
P002|Jane Smith|1992-08-22|1
P003|Bob Wilson|1975-12-03|0

VITALS|patient_id:s,bp:s,hr:i,temp:f|2|S0|W0|C1
P001|120/80|72|98.6
P002|118/76|68|98.2

Browser Support

Works in all modern browsers and Node.js 16+.

| Environment | Support | |-------------|---------| | Chrome | βœ… 80+ | | Firefox | βœ… 75+ | | Safari | βœ… 14+ | | Edge | βœ… 80+ | | Node.js | βœ… 16+ |

Related Packages

| Package | Language | Install | |---------|----------|---------| | dtl-parser | Python | pip install dtl-parser | | dtl-parser | JavaScript | npm install dtl-parser |

License

MIT Β© Padam Sundar Kafle