From 5bdc55ed37905f449d529676dab81a9ae3d7dcb1 Mon Sep 17 00:00:00 2001 From: Jameson Little Date: Fri, 28 Oct 2011 18:04:25 -0600 Subject: [PATCH] Removed require-kiss dependency in favor of pakmanager --- README.md | 6 +++--- examples/index.html | 36 +----------------------------------- examples/main.js | 38 ++++++++++++++++++++++++++++++++++++++ examples/package.json | 10 ++++++++++ lib/header.js | 4 ---- lib/tar.js | 4 ---- lib/utils.js | 4 ---- package.json | 3 +-- 8 files changed, 53 insertions(+), 52 deletions(-) create mode 100644 examples/main.js create mode 100644 examples/package.json diff --git a/README.md b/README.md index 265ebcf..84e5111 100644 --- a/README.md +++ b/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(); diff --git a/examples/index.html b/examples/index.html index 7265319..3075a5a 100644 --- a/examples/index.html +++ b/examples/index.html @@ -3,41 +3,7 @@ Browser Tar - - - - - - + diff --git a/examples/main.js b/examples/main.js new file mode 100644 index 0000000..cff3500 --- /dev/null +++ b/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); +}()); diff --git a/examples/package.json b/examples/package.json new file mode 100644 index 0000000..96f69c2 --- /dev/null +++ b/examples/package.json @@ -0,0 +1,10 @@ +{ + "author": "", + "name": "tar-example", + "engines": { + "node": "~0.4.7" + }, + "main": "./main.js", + "dependencies": { + } +} diff --git a/lib/header.js b/lib/header.js index c401690..c0d7af4 100644 --- a/lib/header.js +++ b/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); }()); diff --git a/lib/tar.js b/lib/tar.js index 4e1f3df..229cda3 100644 --- a/lib/tar.js +++ b/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); }()); diff --git a/lib/utils.js b/lib/utils.js index 292a3aa..374e28c 100644 --- a/lib/utils.js +++ b/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'); }()); diff --git a/package.json b/package.json index 42181d7..1382253 100644 --- a/package.json +++ b/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": "*" } }