Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Moved npm stuff out of src.

  • Loading branch information...
commit 9da21b0abb988b11cf31059a42c38e86c0e83af7 1 parent 1d325dd
@nmrugg authored
View
3  .npmignore
@@ -0,0 +1,3 @@
+demos
+test
+logo*
View
10 index.js
@@ -0,0 +1,10 @@
+/// LZMA-JS
+/// Nathan Rugg
+/// 2013
+/// MIT
+
+///NOTE: This returns a function for backwards compatibility's sake.
+module.exports.LZMA = function LZMA()
+{
+ return require("./src/lzma_worker.js").LZMA;
+}
View
0  src/package.json → package.json
File renamed without changes
View
88 src/readme.md
@@ -1,88 +0,0 @@
-LZMA in a Browser
-===
-
-[LZMA-JS](https://github.com/nmrugg/LZMA-JS) is a JavaScript implementation of the Lempel-Ziv-Markov chain (LZMA) compression algorithm.
-The JavaScript, CSS, and HTML is licensed under the MIT license. See LICENSE for more details.
-
-It is based on [gwt-lzma](http://code.google.com/p/gwt-lzma/), which is a port of the LZMA SDK from
-Java into JavaScript. The original Java code is licensed under the Apache License 2.0 license.
-
-Fundraiser
----
-There's a fundraiser going on at [BountySource](https://www.bountysource.com/fundraisers/475-lzma-js "Fundraiser"). Help get bugs fixed and features added!
-
-Demos
----
-
-Live demos can be found [here](http://nmrugg.github.com/LZMA-JS/ "Demos").
-
-How to Use
----
-
-First, load the bootstrapping code.
-
- /// In a browser:
- <script src="../src/lzma.js"></script>
-
- /// In node:
- var LZMA = require("../src/lzma.js").LZMA;
-
-Create the LZMA object.
-
- /// LZMA([optional path])
- /// If lzma_worker.js is in the same directory, you don't need to set the path.
- /// 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.
-
- /// To compress:
- ///NOTE: mode can be 1-9 (1 is fast but not as good; 9 will probably make your browser crash).
- my_lzma.compress(string, mode, on_finish(result) {}, on_progress(percent) {});
-
- /// 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
----
-
-The calls to compress() and decompress() are asynchronous, so you need to supply a callback function if you
-want to use the (de)compressed data.
-
-If the decompression progress is unable to be calculated, the on_progress() function will be triggered once with the value -1.
-
-LZMA-JS will use [web workers](http://www.whatwg.org/specs/web-workers/current-work/) if they are available. If the
-environment does not support web workers, it will create a few global functions (Worker(), onmessage(), and
-postMessage()) to mimic the functionality.
-
-But I don't want to use Web Workers
----
-
-If you'd prefer not to bother with Web Workers, you can just include <code>lzma_worker.js</code> directly. For example:
-
- <script src="../src/lzma_worker.js"></script>
-
-That will create a global <code>LZMA</code> <code>object</code> that you can use directly. Like this:
-
- LZMA.compress(string, mode, on_finish(result) {}, on_progress(percent) {});
-
- LZMA.decompress(byte_array, on_finish(result) {}, on_progress(percent) {});
-
-Note that this <code>LZMA</code> variable is an <code>object</code>, not a <code>function</code>.
-
-This can also be done in Node.js.
-
- /// Note that there are no parentheses after ".LZMA" because this LZMA variable is an object, not a function.
- var my_lzma = require("lzma/lzma_worker.js").LZMA;
View
2  test/test-node.js
@@ -2,7 +2,7 @@
var all_tests_pass = true,
fs = require("fs"),
- my_lzma = require("../src/lzma.js").LZMA(),
+ my_lzma = require("../index.js").LZMA(),
compression_mode = Number(process.argv[2]) || 1,
path_to_files = "files";

0 comments on commit 9da21b0

Please sign in to comment.
Something went wrong with that request. Please try again.