Permalink
Browse files

Package as proper npm module

  • Loading branch information...
1 parent c893a1d commit 48a04182002cd98e974ec37c4137c5b402195658 @creationix committed Sep 13, 2012
Showing with 19 additions and 172 deletions.
  1. 0 {node_modules → }/middle.js
  2. +0 −118 node_modules/continuable.js
  3. +17 −0 package.json
  4. +0 −52 test-fs.js
  5. +2 −2 test-web.js
  6. 0 {node_modules → }/web.js
File renamed without changes.
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -0,0 +1,17 @@
+{
+ "name": "web",
+ "version": "0.0.0",
+ "description": "A small and fast web/http library for nodejs. (replaces the built-in http module)",
+ "main": "web.js",
+ "dependencies": {},
+ "devDependencies": {},
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/creationix/node-web.git"
+ },
+ "author": "Tim Caswell",
+ "license": "MIT"
+}
View
@@ -1,52 +0,0 @@
-var fs = require('continuable').fs;
-
-copy(__filename, __filename + ".copy")(onCopy)
-
-function copy(inputPath, outputPath) {
- console.log("Copying %s to %s", inputPath, outputPath);
-
- return function (callback) {
- var input, output;
- var totalWritten = 0;
-
- fs.open(inputPath, "r")(onOpenInput);
-
- function onOpenInput(err, fd) {
- if (err) return done(err);
- input = new fs.ReadStream(fd);
- fs.open(outputPath, "w")(onOpenOutput);
- }
-
- function onOpenOutput(err, fd) {
- if (err) return done(err);
- output = new fs.WriteStream(fd);
- input.read()(onRead);
- }
-
- function onRead(err, chunk) {
- if (err) return done(err);
- output.write(chunk)(onWrite);
- }
-
- function onWrite(err, bytesWritten) {
- if (err) return done(err);
- if (bytesWritten) {
- totalWritten += bytesWritten;
- return input.read()(onRead);
- }
- return done();
- }
-
- function done(err) {
- input && input.close()();
- output && output.close()();
- callback(err, totalWritten);
- }
-
- };
-}
-
-function onCopy(err, bytes) {
- if (err) throw err;
- console.log("copied %s bytes", bytes);
-}
View
@@ -1,4 +1,4 @@
-var middle = require('middle');
+var middle = require('./middle');
var fs = require('fs');
function app(req, res) {
@@ -37,7 +37,7 @@ app = middle.autoHeaders(app);
app = middle.log(app);
-var server = require('net').createServer(require('web').socketHandler(app));
+var server = require('net').createServer(require('./web').socketHandler(app));
server.listen(8080, function () {
var address = server.address();
console.log("http://%s:%s/", address.address, address.port);
File renamed without changes.

0 comments on commit 48a0418

Please sign in to comment.