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

projectraven-js

v0.6.0

Published

JavaScript utilities for ProjectRaven's Odin server

Readme

Version 0.5.0 :octocat:

Table of Contents

Installation

ProjectRavenJS is available in the Node Package Manager, so you can install it via npm.


    npm install projectraven-js --save

Get Started

First of all, you have to require the library in your NodeJS project. There are many ways to do that, it depends in the ECMAScript version your are using.


ECMAScript 5

	// instance the ProjectRavenJS utilities
	const ProjectRavenJS = require("projectraven-js")

ECMAScript 6

	// instance the ProjectRavenJS utilities
	import ProjectRavenJS from "projectraven-js"

Usage

ProjectRavenJS is used as utilities for Node.js applications.
Either for Frontend apps and Backend apps. So, you can use them in the way you need it.


ConvertJS

ConvertJS class provides a method called bytesToH that converts bytes and returns a value that is better to understand for human.

bytesToH(bytes: number, si?: boolean)

bytesToH must receive at least one parameter, that should be the bytes you want to convert. And another that is optional, si, and is boolean.

See the following example:

	const ProjectRavenJS = require("projectraven-js")

	// converts 1024 bytes to Kilobyte with binary base
	const bytesA = ProjectRavenJS.convert.bytesToH(1024)
	const bytesB = ProjectRavenJS.convert.bytesToH(1024, true)

	console.log(bytesA) // output: 1.0 KiB
	console.log(bytesB) // output: 1.0 kB

RavenRecord

RavenRecord class provides features to extract data from strings given. This class uses OOP in an implicit way, so, you have to know the basics. These features are useful when you need to extract data from the MQTT topic string for example.


new RavenRecord(topic: string, message: number)

See the following example:

	const { record: RavenRecord } = require("projectraven-js")

	const topic = new RavenRecord("raven-1001/data/T1", 1)

	// output should look like this
	console.log(topic) /*
		RavenRecord {
			valid: true,
			topic: { device: 'raven-1001', schema: 'data', unitid: 'T1' },
			payload: { v: 1, d: 2021-12-16T16:57:17.512Z },
			error: ''
		}
	*/

As you can see, the instance of RavenRecord has to receive two parameters. The first one has to be a string, that should have the correct structure of a topic. And the second one, a number you want to show as message.

License


Software developed in Guatemala distributed under the General Public License v 3.0 you can read the full license here