Permalink
Browse files

Removed require-kiss dependency in favor of pakmanager

  • Loading branch information...
1 parent f28fe10 commit 5bdc55ed37905f449d529676dab81a9ae3d7dcb1 @beatgammit committed Oct 29, 2011
Showing with 53 additions and 52 deletions.
  1. +3 −3 README.md
  2. +1 −35 examples/index.html
  3. +38 −0 examples/main.js
  4. +10 −0 examples/package.json
  5. +0 −4 lib/header.js
  6. +0 −4 lib/tar.js
  7. +0 −4 lib/utils.js
  8. +1 −2 package.json
View
6 README.md
@@ -17,14 +17,14 @@ Dependencies
Tar needs an HTML5 compliant browser. More specifically it needs `Uint8Array` to work.
-The only external module is require-kiss, which makes browser JS much more Node-like.
+The examples depend on pakmanager, a package manager for the browser to make code written for node run in the browser. Install it as such:
-This module can be installed from npm (`npm install require-kiss`) or directly downloaded from github (https://github.com/coolaj86/require-kiss-js).
+`pakmanager build`
Usage Guide
===========
-In your HTML file, make sure that require-kiss is included first. Then, to use it, do something like this:
+The easiest way to interface with it is by using pakmanager. Include the package from pakmanager in your html, and then in you javascript:
var Tar = require('tar'),
tape = new Tar();
View
36 examples/index.html
@@ -3,41 +3,7 @@
<head>
<title>Browser Tar</title>
-<script src='../node_modules/require-kiss/require-kiss.js'></script>
-<script src='../lib/utils.js'></script>
-<script src='../lib/header.js'></script>
-<script src='../lib/tar.js'></script>
-
-<script>
-(function () {
- "use strict";
-
- var Tar = require('tar'),
- utils = require('utils'),
- tape = new Tar(),
- out,
- url,
- base64;
-
- function uint8ToString(buf) {
- var i, length, out = '';
- for (i = 0, length = buf.length; i < length; i += 1) {
- out += String.fromCharCode(buf[i]);
- }
-
- return out;
- }
-
- out = tape.append('output.txt', 'This is test1!');
- out = tape.append('dir/out.txt', 'This is test2! I changed up the directory');
- out = tape.append('arr.txt', utils.stringToUint8('This is a Uint8Array!'));
-
- base64 = btoa(uint8ToString(out));
-
- url = "data:application/tar;base64," + base64;
- window.open(url);
-}());
-</script>
+<script src='./pakmanaged.js'></script>
</head>
<body>
View
38 examples/main.js
@@ -0,0 +1,38 @@
+(function () {
+ "use strict";
+
+ var Tar = require('tar-js'),
+ tape = new Tar(),
+ out,
+ url,
+ base64;
+
+ function uint8ToString(buf) {
+ var i, length, out = '';
+ for (i = 0, length = buf.length; i < length; i += 1) {
+ out += String.fromCharCode(buf[i]);
+ }
+
+ return out;
+ }
+
+ function stringToUint8 (input) {
+ var out = new Uint8Array(input.length), i;
+
+ for (i = 0; i < input.length; i += 1) {
+ out[i] = input.charCodeAt(i);
+ }
+
+ return out;
+ }
+
+
+ out = tape.append('output.txt', 'This is test1!');
+ out = tape.append('dir/out.txt', 'This is test2! I changed up the directory');
+ out = tape.append('arr.txt', stringToUint8('This is a Uint8Array!'));
+
+ base64 = btoa(uint8ToString(out));
+
+ url = "data:application/tar;base64," + base64;
+ window.open(url);
+}());
View
10 examples/package.json
@@ -0,0 +1,10 @@
+{
+ "author": "",
+ "name": "tar-example",
+ "engines": {
+ "node": "~0.4.7"
+ },
+ "main": "./main.js",
+ "dependencies": {
+ }
+}
View
4 lib/header.js
@@ -6,8 +6,6 @@
(function () {
"use strict";
- require('require-kiss');
-
/*
struct posix_header { // byte offset
char name[100]; // 0
@@ -124,6 +122,4 @@ struct posix_header { // byte offset
module.exports.structure = headerFormat;
module.exports.format = formatHeader;
-
- provide('header', module.exports);
}());
View
4 lib/tar.js
@@ -6,8 +6,6 @@
(function () {
"use strict";
- require('require-kiss');
-
var header = require("./header"),
utils = require("./utils"),
recordSize = 512,
@@ -109,6 +107,4 @@
};
module.exports = Tar;
-
- provide('tar', module.exports);
}());
View
4 lib/utils.js
@@ -6,8 +6,6 @@
(function () {
"use strict";
- require('require-kiss');
-
var lookup = [
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
@@ -90,6 +88,4 @@
module.exports.extend = extend;
module.exports.stringToUint8 = stringToUint8;
module.exports.uint8ToBase64 = uint8ToBase64;
-
- provide('utils');
}());
View
3 package.json
@@ -1,7 +1,7 @@
{
"name": "tar-js",
"description": "Tar implemented in the browser",
- "version": "0.1.1",
+ "version": "0.2.0",
"homepage": "http://github.com/beatgammit/tar-js",
"repository": {
"type": "git",
@@ -14,6 +14,5 @@
"lib": "lib"
},
"dependencies": {
- "require-kiss": "*"
}
}

0 comments on commit 5bdc55e

Please sign in to comment.