New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

deflate-js

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

deflate-js - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

bin/deflate.js

24

lib/rawdeflate.js

@@ -370,3 +370,3 @@ /*

for(i = 0; i < n && deflate_pos < deflate_data.length; i++)
buff[offset + i] = deflate_data.charCodeAt(deflate_pos++) & 0xff;
buff[offset + i] = deflate_data[deflate_pos++] & 0xff;
return i;

@@ -1631,6 +1631,6 @@ }

function deflate(str, level) {
var i, j, buff, aout, cbuf;
function deflate(arr, level) {
var i, j, buff;
deflate_data = str;
deflate_data = arr;
deflate_pos = 0;

@@ -1643,15 +1643,13 @@ if(typeof level === "undefined") {

buff = [];
aout = [];
while((i = deflate_internal(buff, 0, 1024)) > 0) {
cbuf = [];
for(j = 0; j < i; j++){
cbuf[j] = String.fromCharCode(buff[j]);
}
aout[aout.length] = cbuf.join("");
}
do {
i = deflate_internal(buff, buff.length, 1024);
} while (i > 0);
deflate_data = null; // G.C.
return aout.join("");
return buff;
}
module.exports = deflate;
module.exports.DEFAULT_LEVEL = DEFAULT_LEVEL;
}());

@@ -340,3 +340,3 @@ /*

return -1;
return inflate_data.charCodeAt(inflate_pos++) & 0xff;
return inflate_data[inflate_pos++] & 0xff;
}

@@ -767,20 +767,15 @@

function inflate(str) {
function inflate(arr) {
var buff = [],
aout = [],
i, j, cbuf;
i, j;
inflate_start();
inflate_data = str;
inflate_data = arr;
inflate_pos = 0;
while((i = inflate_internal(buff, 0, 1024)) > 0) {
cbuf = []; // new Array(i); // cbuf.length is never called
for(j = 0; j < i; j++){
cbuf[j] = String.fromCharCode(buff[j]);
}
aout[aout.length] = cbuf.join("");
}
do {
i = inflate_internal(buff, buff.length, 1024);
} while (i > 0);
inflate_data = null; // G.C.
return aout.join("");
return buff;
}

@@ -787,0 +782,0 @@

@@ -9,4 +9,7 @@ {

"description": "DEFLATE implemented in JavaScript (works in browser and Node)",
"version": "0.1.0",
"version": "0.2.0",
"main": "./index.js",
"bin": {
"gzip-js": "./bin/runner.js"
},
"repository": {

@@ -17,3 +20,3 @@ "type": "git",

"scripts": {
"test": "cd test ; ./checks-generator.py ; ./runner.js ; cd -"
"test": "cd test ; ./runner.py; cd -"
},

@@ -24,3 +27,5 @@ "engines": {

"dependencies": {},
"devDependencies": {}
"devDependencies": {
"optimist": "~0.2"
}
}

@@ -8,2 +8,4 @@ Intro

Currently deflate does not pass all tests, but inflate does. This should not be used for compressing data yet in production.
Install

@@ -21,5 +23,5 @@ =======

> *deflate(str[, level])*
> *deflate(arr[, level])*
>
> **str**- The string to compress
> **arr**- Byte array to compress
>

@@ -30,6 +32,6 @@ > **level**- 1-9 (compression level; optional)

> *inflate(str)*
> *inflate(arr)*
>
>
> **str**- The string to decompress
> **arr**- Byte array to decompress

@@ -41,10 +43,13 @@ The basic usage (no level) will suffice for most purposes.

var deflate = require('deflate-js');
var deflate = require('deflate-js'),
arr;
arr = Array.prototype.map.call('Hello world', function (char) {
return char.charCodeAt(0);
});
// compress some text
var compressed = deflate.deflate('Hello world');
var compressed = deflate.deflate(arr);
// decompress some text
var decompressed = deflate.inflate(compressed);

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc