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 🙏

© 2025 – Pkg Stats / Ryan Hefner

strim-js

v1.0.48

Published

Streaming Transports Relay Isomorphic Modules

Downloads

11

Readme

STRIM 🌊

Streaming Transports Relay Isomorphic Modules

Installation

npm i -S strim-js

or

yarn add strim-js

Usage

Write a module in your modules directory

// myModules/myAmazingModule/package.json
// myModules/myAmazingModule/index.js

Server side (only if you need to run some of your modules on the server)

// server.js
const http = require('http')
const express = require('express')
const { setStrimModules, setWs } = require('strim-js/dist/strimModules');

const app = express()

setStrimModules(app, { modulesPath: './myStrimModules' });
const httpServer = http.createServer(app);

setWs(httpServer);
httpServer.listen(80);

Client side

// client.js

Full Example

import Strim from 'strim-js'

new Strim()
  .pipe({
    module: 'myAmazingModule',
    func: 'get',
    args: [1, 2, 4],
  })
  .toServer()
  .pipe({
    module: 'myAmazingModule',
    func: 'runningSum',
  })
  .subscribe(
    value => {
      console.log('Current Value:', value)
    },
    err => {
      console.error('Error Occurred:', err)
    },
    () => {
      console.log('Done')
    },
  )

API

Strim

The core class which activates the strim flow

Strim instance public methods

constructor(options)
  • options: An object containing general strim options.
    • wsUrl (Default 'ws://localhost:4321/strim'): The websocket url.:
    • modulesDir: define where the modules directory
pipe(options)
  • options: An object containing piped function options.
    • module (Default 'global'): The module name that will be imported for use of the pipe.
    • func (Default 'default'): The function name within the module.:
    • env (Default last func's environment): The environment in which we want the function to run in (can be Environment.Client or Environment.Server).:
    • args: arguments that will be sent to the piped function.
toClient(worker)
  • worker (Default false): Whether to open in a worker or not.
toServer(worker)
  • worker (Default false): Whether to open in a worker or not.
subscribe(onNext, onError, onComplete)
  • onNext (Default console.log): callback function that will occur every time a new value is received.
  • onError (Default console.error): callback function that will occur when an error is received.
  • onComplete: callback function that will occur the strim is complete.

setStrimModules(app, options)

  • app: The Express application to set up strim on.
  • options (Optional): An object containing further options.
    • wsRoute (Default '/strim'): The route path for strim's endpoint.
    • modulesPath (Default 'node_modules'): The path to the directory of the modules.

Development

This module is written as part of Wix guild week, we'll be happy to have people help.

just clone the repo, yarn and yarn test