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

nemo-lib

v0.0.1

Published

Library for system wide functionality inside the NEMO BRiDGE ecosystem

Readme

NEMO Library

pipeline status coverage report

Quick Start

install

  npm i -S @nowtilus/nemo-lib

usage

  const {storageAdapter, nemoResources} = require('nemo-lib')
  
  // Working with Nemo Resources
  nemoResources.message.create(messageObject)

  // Using the storage adapter
  const storage = storageAdapter.create({
    type: 'azure',
    account: 'my-account-name',
    key: process.env.KEY
  })
  storage.list() // lists all files in the blob storage

Use-Cases

  • Every NEMO service provides an API to create, read, update and delete resources to simplify the interaction between services the nemo-lib can be used in a unified manner.
  • From time to time there are services that need to implement the same functionality. To reduce code dupliocation the nemo-lib is a good place to store those functions.

NEMO Service Resources

The followoing resources are provided via nemo-lib

  • messages.create()

Fire and forget

As fire and forget implementation you can simply call the message. Any error or non 2xx response ocuring while making the request wiill be logged to the console.

  messages.create(message)

Waiting for the feedback

The methods are promise based and will throw any error or non-2xx respnse.

  messages.create(message)
    .then(result => console.log(`The created message: ${JSON.stringify(result)}`))
    .catch(e => console.error(`An Error ocured: ${JSON.stringify(e)}`))

or async await style

  (async () => {
    try {
      const result = messages.create(message)
      console.log(`The created message: ${JSON.stringify(result)}`)
    } catch (e) {
      console.error(`An Error ocured: ${JSON.stringify(e)}`)
    }
  })()

Options

To control the bahaviour of the request in more detail you can specify options. Those are as unified as possible. E.g. for every resource.read method you'll find a "limit" and "offset" option.

NEMO Storage Adapter Module

The storage adapter provides a unified streaming api to move files easely between different storages. E.g. Download a file from a url and pipe it to an internal Azure or AWS storage.

Features:

  • Internal complexity of using different storages is completely abstracted away
  • No need to have enough disc space thanks to streaming
  • The library can be used to build CLI tools that support unix pipes (e.g. my-cli | grep "search-text" | sort - r)

Supported Storages

Available:

  • File System (local hdd or any mounted storage)
  • Azure Blob Storage
  • HTTP (read only)

Planned:

  • AWS S3

Storages have the following actions

  • list() // Lists all files in a provided directory
  • getDetails() // Provides detailed information related to one file
  • writeSourceToStream() // Generates a data stream from a file
  • createWriteStream() // Geneate a write stream to a place on the storage
  • saveStreamToTarget() // Save a stream to a place at the storage
  • delete() // Deletes a file or directory on the storage

Examples

Actions on one storage

Note:

All read processes have the following success response (not all fields are provided by every storage - fields that are not available are set to null)

{
  name: 'maxresdefault.jpg',
  size: '75477',
  modifiedAt: 'Mon, 18 Dec 2017 12:18:44 GMT',
  createdAt: 'Mon, 18 Dec 2017 12:18:44 GMT'
}

All streaming and write processes will resolve with an success message or reject with an error

List files of a storage
const localAdapter = require('nemo-lib').storageAdapter.create({
  type: 'local',
  root: '.'
})

localAdapter
  .list('examples')
  .then(result => {
    console.log(result.map(r => r.name)) // --> [ 'http-to-azure.js', 'local-adapter.js' ]
  })
  .catch(e => console.error(e))

Get file details

const httpAdapter = require('nemo-lib').storageAdapter.create('http')

httpAdapter
  .getDetails('https://www.elastic.co/assets/blt3541c4519daa9d09/maxresdefault.jpg')
  .then(result => {
    console.log(result)
    /*
      {
        name: 'maxresdefault.jpg',
        size: '75477',
        modifiedAt: 'Mon, 18 Dec 2017 12:18:44 GMT',
        createdAt: 'Mon, 18 Dec 2017 12:18:44 GMT'
      }
    */
  })
  .catch(e => console.error(e))
Delete a blob on an Azure storage
const httpAdapter = require('nemo-lib').storageAdapter.create({
  type: 'azure',
  account: 'nowtilusingeststaging',
  key: process.env.KEY
})

azureAdapter.delete('quality-assurance/nowtilus.png')
  .then(result => {
    console.log(result) // --> 'Deleted quality-assurance/nowtilus.png'
  })
  .catch(e => console.error(e))
More examples for single storage actions
  • Local storage: ./examples/storage-adapter/local-adapter.js
  • Azure storage: ./examples/storage-adapter/azure-adapter.js

Actions between storages

Stream from http to azure storage
const AdapterFactory = require('nemo-lib').storageAdapter

// instantiate an adapter for http
const httpAdapter = AdapterFactory.create('http')

// instantiate an adapter for azure-blob
const azureAdapter = AdapterFactory.create({
  type: 'azure',
  account: 'myteststorage',
  key: process.env.KEY
})

// define the https source
const source = 'https://static.wixstatic.com/media/ef8b8b_910bcc934fa740c4a020b57b54686b35~mv2.png/v1/fill/w_231,h_33,al_c,q_90/nowtilus-sRGB-XL.webp'

// create a write stream to the target
const writeStream = azureAdapter.createWriteStream(
  'quality-assurance/nowtilusy.png'
)

// generate a source stream and pipe it to the target stream
httpAdapter
  .writeSourceToStream(source, writeStream)
  .then(r => console.log(`Stream finished: ${JSON.stringify(r)}`))
  .catch(e => console.log(e))
More examples for stream actions
  • Copy from HTTP Url to Azure Blob Storage: ./examples/storage-adapter/http-to-azure.js

Contribution Guidance

  • crutial to success
  • always (close to) 100% test coverage
  • stable