Neoprene Party Masks


    0.6.0 • Public • Published

    ProjectRaven logo

    JavaScript utilities for ProjectRaven's Odin server

    Version 0.5.0 :octocat:

    Table of Contents


    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"


    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 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 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.


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

    LesliTech logo




    npm i projectraven-js


    DownloadsWeekly Downloads






    Unpacked Size

    165 kB

    Total Files


    Last publish


    • leslitech