Permalink
Browse files

Added npm package and fixed a few minor issues.

  • Loading branch information...
1 parent 6427ef2 commit 0a81d59349778f27699eba6ee413f584b79861a0 @nmrugg nmrugg committed Jun 10, 2011
Showing with 40 additions and 4 deletions.
  1. +5 −3 demos/simple_node_demo.js
  2. +9 −0 package.json
  3. +13 −1 readme.md
  4. +1 −0 src/README.md
  5. +12 −0 src/package.json
@@ -1,15 +1,17 @@
/// Usage: $ node simple_node_demo.js [text]
-var LZMA = require("../src/lzma.js").LZMA(),
+///NOTE: You can install LZMA.JS via npm with this command: $ npm install lzma
+/// Then you can load the code with the following code: var my_lzma = require("lzma").LZMA();
+var my_lzma = require("../src/lzma.js").LZMA(),
compress_me = (process.argv[2] || "Hello, world."),
compression_mode = 1;
/// First, let's compress it.
-LZMA.compress(compress_me, compression_mode, function (result) {
+my_lzma.compress(compress_me, compression_mode, function (result) {
console.log("Compressed: " + result);
/// Now, let's try to decompress it to make sure it works both ways.
- LZMA.decompress(result, function (result) {
+ my_lzma.decompress(result, function (result) {
console.log("Decompressed: " + result);
}, function (percent) {
/// Decompressing progress code goes here.
View
@@ -0,0 +1,9 @@
+{
+ "name": "lzma",
+ "version": "1.0.0",
+ "description": "A standalone JavaScript implementation of the Lempel-Ziv-Markov chain (LZMA) compression algorithm",
+ "homepage": "https://github.com/nmrugg/LZMA-JS",
+ "author": "Nathan Rugg <nmrugg@gmail.com>",
+ "keywords": ["lzma", "compression", "decompression"],
+ "bin" : { "node-inspector" : "./bin/inspector.js" }
+}
View
@@ -27,7 +27,7 @@ Create the LZMA object.
/// LZMA([optional path])
/// If lzma_worker.js is in the same director, you don't need to set the path.
- /// You should be able to do the first two steps simultaneously in Node.js: var LZMA = require("../src/lzma.js").LZMA();
+ /// You should be able to do the first two steps simultaneously in Node.js: var my_lzma = require("../src/lzma.js").LZMA();
var my_lzma = new LZMA("../src/lzma_worker.js");
(De)Compress stuff.
@@ -39,6 +39,18 @@ Create the LZMA object.
/// To decompress:
my_lzma.decompress(byte_array, on_finish(result) {}, on_progress (percent) {});
+Node.JS Installation
+---
+
+LZMA.JS is available in the npm repository. If you have [npm](https://github.com/isaacs/npm) installed, you can install it by running
+
+ $ npm install lzma
+
+and load it with the following code:
+
+ var my_lzma = require("lzma").LZMA();
+
+
Notes
---
View
View
@@ -0,0 +1,12 @@
+{
+ "author": "Nathan Rugg <nmrugg@gmail.com>",
+ "name": "lzma",
+ "description": "A standalone JavaScript implementation of the Lempel-Ziv-Markov chain (LZMA) compression algorithm",
+ "version": "1.0.0",
+ "homepage": "https://github.com/nmrugg/LZMA-JS",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/nmrugg/LZMA-JS.git"
+ },
+ "main": "lzma.js"
+}

0 comments on commit 0a81d59

Please sign in to comment.