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

@siraglovale/utils

v2.0.0

Published

![Build](https://img.shields.io/badge/build-passing-green.svg)

Readme

UTILITIES

Build

A set of application utilities that will come in useful in Node.js

Install

npm install @siraglovale/utils

Usage

This module should be imported into your entry point, this will then setup global functions that can be used within your project.

Application Functions

utils.setApplication(_application_)

Sets the application specific information within the node project

  • _application_: <Object>
    • name: <string>
    • version: <string>

Global Functions

log(_message_)

Log to stdout a message with a timestamp and information about the application

  • _message_: <any>

error(_message_)

Log to stderr a message with a timestamp and information about the application

  • _message_: <any>

Encoding Functions

utils.asciitoB64(_ascii_)

Converts an ascii string to a base64 string

  • _ascii_: <string>

utils.asciitoHex(_ascii_)

Converts an ascii string to a hex string

  • _ascii_: <string>

utils.asciitoUTF8(_ascii_)

Converts an ascii string to a utf-8 string

  • _ascii_: <string>

utils.b64toUTF16LE(_ascii_)

Converts an ascii string to a utf-16 little endian string

  • _ascii_: <string>

utils.b64toAscii(_base64_)

Converts a base64 string to an ascii string

  • _base64_: <string>

utils.b64toHex(_base64_)

Converts a base64 string to a hex string

  • _base64_: <string>

utils.b64toUTF8(_base64_)

Converts a base64 string to a utf-8 string

  • _base64_: <string>

utils.b64toUTF16LE(_base64_)

Converts a base64 string to a utf-16 little endian string

  • _base64_: <string>

utils.hextoAscii(_hex_)

Converts a hex string to an ascii string

  • _hex_: <string>

utils.hextoB64(_hex_)

Converts a hex string to a base64 string

  • _hex_: <string>

utils.hextoUTF8(_hex_)

Converts a hex string to a utf-8 string

  • _hex_: <string>

utils.hextoUTF16LE(_hex_)

Converts a hex string to a utf-16 little endian string

  • _hex_: <string>

utils.utf8toAscii(_utf8_)

Converts a utf8 string to an ascii string

  • _utf8_: <string>

utils.utf8toB64(_utf8_)

Converts a utf8 string to a base64 string

  • _utf8_: <string>

utils.utf8toHex(_utf8_)

Converts a utf8 string to a hex string

  • _utf8_: <string>

utils.utf8toUTF16LE(_utf8_)

Converts a utf8 string to a utf-16 little endian string

  • _utf8_: <string>

Password Functions

utils.hashPassword(password, secret)

Hash your password with a pseudo-randomly generated salt.

  • password: <string>
  • secret: <string> CONSTANT

utils.hashPasswordWithBcrypt(password, saltRounds)

Hash a password with bcrypt

  • password: <string>
  • saltRounds: <number>

utils.hashPasswordWithBcryptSync(password, saltRounds)

Hash a password with bcrypt synchronously

  • password: <string>
  • saltRounds: <number>

utils.validatePassword(password, hash, secret)

Validate a submitted password against a hash stored in your database

  • password: <string>
  • hash: <string>
  • secret: <string> CONSTANT

utils.verifyBcryptPassword(password, hash)

Validates a bcrypt password

  • password: <string>
  • hash: <string>

utils.verifyBcryptPasswordSync(password, hash)

Validates a bcrypt password synchronously

  • password: <string>
  • hash: <string>

2 Factor Authentication Functions

utils.genSecret(_email)

Generate a secret for use in 2 Factor Authentication, this is used to generate the TOTP

  • _email: <string>

utils.genQR(_email, _secret)

Generate a QR Code for the user based of the secret generated using genSecret, to use in conjunction with Google Authenticator, Authy or similar

  • _email: <string>
  • _secret: <string>

utils.verifyTFA(_token, _secret)

Returns an object that the token relates to, and, verifies the user

  • _token: <string>
  • _secret: <string>

Demo

Example

let utils = require("@siraglovale/utils"); // require module

utils.setApplication({
  name: "application_1",
  version: "0.1.0"
});

log("Hello World!");
// stdout
// [email protected][Thu Sep 14 2017 22:41:48 GMT+0100 (GMT Summer Time)] -> Hello World!

error("error");
// stderr
// [email protected][Thu Sep 14 2017 22:41:48 GMT+0100 (GMT Summer Time)] -> error