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

sga-patch

v0.0.6

Published

SGA Patch - diff update generator for SGA software

Readme

sga-patch

Software Update Patch Generation Utility for NodeJs and NWJS Applications

This tool allows user to generate an installation patch that allows for remote upgrading of NodeJs and NWJS applications.

To generate a patch archive, user must supply two folders - A: Existing folder deployed on user systems (previous software version deployment); B - folder that is meant to be deployed (new software version deployment); Patch Generator will compare both folders, identify differences, compress them using ZIP/DEFLATE compression and package them into a proprietary patch file.

Features:

  • Proprietary file format
  • File header validation (won't accept garbage or corrupt downloads)
  • SHA256 content signature validation
  • Content signing with private RSA key
  • Optional validation with public RSA key
  • Optional comparison of name field in package.json (to ensure that patch is not being applied to a different project)
  • All data is compressed

Public RSA key is meant to be installed on client systems. RSA signature validation prevents hostile actors from publishing updates even if they are able to gain access to the server infrastructure.

Install via NPM:

npm install -g sga-patch

Generate RSA keypair:

sga-patch generate-keys

Create patch archive:

sga-patch package <source folder> <dest folder> <archive filename> NOTE: You must use quotes if folders contain spaces.

To execute update process:

  • Download patch file
  • Make sure you have a local copy of .sga-rsa-pub file
  • Read .sga-rsa-pub file
  • Run the following code:
var Patch = require('sga-patch');
var pgen = new Patch(/*{ trace : true }*/);
pgen.applyPatch('patch-filename.sga-patch', 'destination/folder/', /* Options: */ { pkcs1 : /* .sga-rsa-pub contents */, testPackageName : true }, callback);

Options:

  • pkcs1 - if defined, should contain RSA pub key. Patch deployment will fail if key signature does not match.
  • testPackageName - if true target folder will be tested for package name in package.json and patch deployment will fail if it does not match the name of the package from which patch has been generated.

Full example:

var fs = require('fs');
var Patch = require('sga-patch');

var pgen = new Patch(options);

var pkcs1 = fs.readFileSync('.sga-rsa-pub','utf8');
pgen.applyPatch('test-archive.sga-patch','c:/dev/project/test-output/', { pkcs1, testPackageName : true }, function(err) {
	if(err) {
		console.log("Error:",err.toString());
		err && err.stack && console.log(err);
	}
	else {
		console.log('Patch applied!');
	}
})

NOTE: If you are testing patch deployment against the target folder, you may get console warnings in case patch is unable to delete folders or files that should exist in the target destination.