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

@johntalton/ndef

v1.0.3

Published

![CI](https://github.com/johntalton/st25dv/workflows/CI/badge.svg)

Downloads

30

Readme

NDEF

CI

NDEF encode and decode library.

Follows Web NFC Spec conventions.

With support for Capability Container and Type 5 wrapper objects.

Encoder / Decoder

The Web NFC spec describes two basic format/class structures when working with NDEF - NDEFMessage and NDEFRecord.

A Message is a wrapper type for a list of records.

Each record represents an object having recordType and data properties (as well as other depending on type).

There are a wide range of "Well Known" record types supported.

Common recordTypes

In most case the data field of the record is an ArrayBuffer or ArrayBufferView (aka Uint8Array). However, some well know types are parsed for the user.

  • 'empty'
  • 'url' - data is URL string
  • 'text'
  • 'smart-poster' - data is NDEFMessage call toRecords to iterate or access data directly to parse in application space.
  • 'mime' - mediaType contains further information about data
  • 'absolute-url' - data is a URL string
  • 'unknown'

Example Decoding with CC wrapper

import { CapabilityContainer } from '@johntalton/ndef'

// see st25dv https://github.com/johntalton/st25dv for init
const st25dv = new ST25DVUser(/* ... */)

 // read 64 bytes starting at offset 0
const buffer = await st25dv.readMemory(0, 64)

const cc = CapabilityContainer.decode(buffer)
for(const record of cc.message.records) {
  const { recordType, id, data } = record

  console.log('id:', id)
  console.log('recordType:', recordType)
  if(recordType === 'mime' && record.mediaType === 'application/json') {
    const decoder = new TextDecoder()
    const json = JSON.parse(decoder.decode(data))
  }
  else {
    // do other stuff
  }
}

Example Encoding without CC

import { NDEFMessageEncoder, CONTEXT_ROOT } from '@johntalton/ndef'

const buffer = NDEFMessageEncoder.encode({
  records: [
    {
      recordType: 'url',
      data: 'https://github.com/johntalton/ndef'
    },
    {
      recordType: 'text',
      data: 'NDEF library in JS'
    },
  ]
}, CONTEXT_ROOT, 0)

// do something with buffer ...

Capability Container & Type 5 Tag

Included in this library is an implementation of the CC/T5T wrapper format needed to write NDEF Message onto a device (such as the st25dv)

The CapabilityContainer provides a encode/decode that will account for the TLV (Type Length Value) container as well as the devices CCFile.

CapabilityContainer provides access to permissions for read and write as well as the root NDEFMessage via message.

(This has limited testing beyond above mentioned st25dv device and basic memory layout - feedback welcome :P)