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 🙏

© 2024 – Pkg Stats / Ryan Hefner

voidspace

v0.1.81

Published

Transfer variables between threads, programs, and devices.

Downloads

25

Readme

Voidspace

Status: Working Beta

Voidspace let's programs share variables across processes, programs, and even devices! Here is the current todo list.

In the box

When you fetch the VoidSpace module from NPM, you will not only get the module, but the VoidSpace server as well, which is the hub transferring data. Make sure an instance of the VoidSpace server is available at run-time of your application. Ideally, the module will eventually instantiate an instance with the global settings if it isn't already running.

Usage

To use voidspace, you must first install the module with the following command-line command:

npm install --save voidspace

Now we can go ahead and use it! For every pool you want to work with, create a new Voidspace instance. Here's how we create an instance:

var testpool = require('voidspace');

Connecting

Now we can connect to the voidspace server. If this is run on our local machine, we can do that with

testpool.connect();

Which will connect to localhost, port 3552. Port 3552 is the default port for the Voidspace server and is currently unconfigurable. If we don't have the server locally, we can pass a websocket URL to the server:

testpool.connect('ws://the-url.com:3552');

Don't forget to add port 3552!

Joining and Creating

Once connected to the server we can now specify a pool. If we want to create a new pool we can use:

testpool.create("#pool-name");

And to join an existing pool we can use:

testpool.join("#pool-name");

Only use one of these per voidspace instance. If you attempt to create or join more than one pool with the same instance it will ignore the old pool and connect to the new and begin to glitch. Always make a new voidspace instance.

Setting and Getting

We can easily set and get values. Continuing with our 'testpool' voidspace instance, to set a value we would use:

testpool.set('key', 'value');

where key is the key to access this value by later, and value is the actual data to store. Value can be almost anything. If it doesn't throw errors, it's working. We can also get set values using:

var value = testpool.get('key');

Using that will get the value from the pool with the key we pass, and assign the value to the value variable. There are currently no asynchronous methods for getting or setting values.

Saving and Loading saved pools

Any pool can be saved regardless of whether your Voidspace instance is the owner, or not. You can save your pool to a file using:

testpool.save(__dirname + '/path-to-file.json');

Some important details are included here. It's important that you add __dirname and a slash as shown in the example. This is so node can build the file path correctly. In the future we will attempt to make this method more rigid and try to figure out where the file is when the first attempt to load fails. To load a file respectively you use:

testpool.load(__dirname + '/path-to-file.json');

It's really that easy!

More

If a feature is not outlined in the quick tutorial above, make sure to request an explanation on the repository via issues, and remind us to add an example!