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 🙏

© 2025 – Pkg Stats / Ryan Hefner

nil-zonefile

v0.3.0

Published

A library for parsing and creating zonefiles on the new internet.

Downloads

31

Readme

NIL Zonefile

A Rust library for parsing and creating NIL zonefiles. This library supports both WebAssembly and native Rust environments.

Installation

Add this to your Cargo.toml:

[dependencies]
nil-zonefile = "0.1.0"

For WebAssembly support, enable the wasm feature:

[dependencies]
nil-zonefile = { version = "0.1.0", features = ["wasm"] }

Usage

Rust

use nil_zonefile::ZoneFile;
fn main() -> Result<(), serde_json::Error> {
// Parse a zonefile
let json_str = r#"{
"zonefile": {
"owner": "SP3D03X5BHMNSAAW71NN7BQRMV4DW2G4JB3MZAGJ8",
"general": "Example Name",
"twitter": "@example",
"url": "example.locker",
"nostr": "",
"lightning": "",
"btc": "bc1..."
}
}"#;
let zonefile = ZoneFile::from_str(json_str)?;
// Convert back to JSON
let output = zonefile.to_string()?;
Ok(())
}

JavaScript/TypeScript (via WebAssembly)

=

import { ZoneFile } from 'nil-zonefile';

const zonefile = ZoneFile.fromString(jsonString);
const output = zonefile.toString();

Rust CBOR Support

use nil_zonefile::ZoneFile;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Read from CBOR
    let cbor_bytes: &[u8] = &[0u8; 0];  // example empty CBOR data
    let zonefile = ZoneFile::from_cbor(cbor_bytes)?;

    // Write to CBOR
    let output_bytes: Vec<u8> = zonefile.to_cbor()?;
    Ok(())
}

JavaScript CBOR Support

import { parse_zonefile_cbor, create_zonefile_cbor } from 'nil-zonefile';

// Read from CBOR
const cborBytes = new Uint8Array(/* your CBOR data */);
const result = parse_zonefile_cbor(cborBytes);

// Write to CBOR
const output = create_zonefile_cbor(cborBytes);

Generate Zonefile

import { generateZonefile } from 'nil-zonefile';

const zonefile = {
    zonefile: {
        owner: "SP3D03X5BHMNSAAW71NN7BQRMV4DW2G4JB3MZAGJ8",
        general: "Example Name",
        twitter: "@example",
        url: "example.locker",
        nostr: "",
        lightning: "",
        btc: "bc1...",
        subdomains: {}
    },
    version: "1.0.0",
    status: "current"
};

// Generate uncompressed CBOR
const bytes = generateZonefile(zonefile);

// Generate compressed CBOR using zstd compression
const compressedBytes = generateZonefile(zonefile, true);

Building on macOS

When building this project on macOS (especially for WebAssembly), you need LLVM installed and configured correctly. Two options are available:

Option 1: Using the Setup Script

Run the provided setup script:

source ./setup-llvm.sh

This script will:

  1. Check if you're on macOS
  2. Install LLVM via Homebrew if needed
  3. Set up the required environment variables

Option 2: Manual Setup

  1. Install LLVM if you haven't already:

    brew install llvm
  2. Set up the required environment variables:

    export PATH="/opt/homebrew/opt/llvm/bin:$PATH"
    export CC=/opt/homebrew/opt/llvm/bin/clang
    export AR=/opt/homebrew/opt/llvm/bin/llvm-ar

    To make these changes permanent, add the above lines to your ~/.zshrc or ~/.bash_profile.

License

MIT License - Copyright (c) 2025 New Internet Labs Limited