
Company News
/Security News
Socket Selected for OpenAI's Cybersecurity Grant Program
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.
json-shrink
Advanced tools
shrink objects/json with LZMA (7-zip) or Brotli compression + optional jsonpack
var shrunken = shrink(obj, outputAsString = false, doPack = true, doUseBrotli = false);
var unshrunk = unshrink(shrunken, doUnPack = true, doUseBrotli = false);
npm i json-shrink
var jsh = require('json-shrink');
var shrink = jsh.shrink;
var unshrink = jsh.unshrink;
//compressing json into buffer or string:
//shrink(obj, outputAsString = false, doPack = true, doUseBrotli=false)
var original_obj = {ok:"here is some text"};
var compressed_into_buffer = shrink(original_obj); //output as buffer
var compressed_into_string = shrink(original_obj, true); // output as base64 string
//uncompressing
//note - params used for uncompressing must align with the params used for compressing!
//unshrink(shrunken, doUnPack = true, doUseBrotli=false);
console.log("uncompressed str", unshrink(compressed_into_string));
console.log("uncompressed buffer", unshrink(compressed_into_buffer));
//result
//uncompressed str { ok: 'here is some text' }
//uncompressed buffer { ok: 'here is some text' }
//with jsonpack disabled:
var compressed_buffer_nopack = shrink(original_obj, false, false);
var compressed_string_nopack = shrink(original_obj, true, false);
console.log("uncompressed str - no jsonpack", unshrink(compressed_string_nopack, false));
console.log("uncompressed buffer - no jsonpack", unshrink(compressed_buffer_nopack, false));
//result
//uncompressed str - no jsonpack { ok: 'here is some text' }
//uncompressed buffer - no jsonpack { ok: 'here is some text' }
json-shrinkFAQs
shrink json objects with LZMA (7-zip) or Brotli compression + jsonpack
The npm package json-shrink receives a total of 460 weekly downloads. As such, json-shrink popularity was classified as not popular.
We found that json-shrink demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.

Security News
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.

Research
/Security News
Campaign of 108 extensions harvests identities, steals sessions, and adds backdoors to browsers, all tied to the same C2 infrastructure.