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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@nbsjs/core

v6.0.0

Published

Robust API for reading and writing OpenNBS files.

Downloads

9

Readme

nbs.js

Robust API for reading, manipulating, and writing OpenNBS files, inspired by NBSEditor and NBS4j.

It's cleanroom, too! No required dependencies!

NPM Badge Docs Badge

🔧 Including

[!IMPORTANT]
This library does not bundle CommonJS modules. Legacy Node.js applications may not be compatible.

[!TIP] When linking to esm.run, it's recommended to use a version! (e.g. @nbsjs/[email protected])

🟢 Node.js

Add the @nbsjs/core package using the package manager of your choice.

import { Song } from "@nbsjs/core";

🌐 Browser


<script type="module">
	import { Song } from "https://esm.run/@nbsjs/core";
</script>

🦕 Deno

import { Song } from "https://esm.run/@nbsjs/core";

❔ FAQ

Install nbs.js for your platform, then refer to the documentation and examples below.

There are more examples designed for use with Node.js in the examples directory!

import { readFileSync } from "node:fs";
import { fromArrayBuffer } from "@nbsjs/core";

const songFile = readFileSync("song.nbs"); // Read the selected NBS file
const buffer = new Uint8Array(songFile).buffer; // Convert it into an ArrayBuffer
const song = fromArrayBuffer(buffer); // Parse the buffer

console.dir(song);
<input type="file" id="file-input">

<script type="module">
	import { fromArrayBuffer } from "https://esm.run/@nbsjs/core"

	window.addEventListener("load", () => {
		const input = document.getElementById("file-input");

		// Initialize file input
		input.addEventListener("change", () => {
			const songFile = input.files[0]; // Read the selected NBS file
			songFile.arrayBuffer().then(buffer => { // Convert it into an ArrayBuffer
				const song = fromArrayBuffer(buffer); // Parse the buffer

				console.dir(song);
			});
		});
	});
</script>
import { fromArrayBuffer } from "https://esm.run/@nbsjs/core";

const songFile = await Deno.readFile("song.nbs"); // Read the selected NBS file
const buffer = new Uint8Array(songFile).buffer; // Convert it into an ArrayBuffer
const song = fromArrayBuffer(buffer); // Parse the buffer

console.dir(song);

Currently, a website to demonstrate usage of the library does not exist. However, this repository contains tests that could be used as examples, and actual examples designed for Node.js and similar.

I don't create GitHub releases, but I do keep a changelog here!

🔨 Building

Ensure that Bun is installed.

  1. Enter the directory containing the nbs.js source code in your terminal.
  2. Install the build dependencies via bun install.
  3. Run bun run build to bundle the ESM module.

Generated files:

  • dist/*.js: Bundled ESM files for Node.js and related
  • dist/*.d.ts: Generated TypeScript type bundle
  • public/docs/*: Generated web-based documentation