Skip to content

Commit

Permalink
Merge branch 'master' of github.com:creationix/creationix
Browse files Browse the repository at this point in the history
  • Loading branch information
creationix committed Aug 11, 2011
2 parents a575c51 + 8047b7f commit 102ddb1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -0,0 +1 @@
node_modules
16 changes: 16 additions & 0 deletions uploader.js
@@ -0,0 +1,16 @@
var FS = require('fs'),
Url = require('url');

module.exports = function setup(mount, root) {
return function handle(req, res, next) {
if (req.method !== "PUT") return next();
if (!req.uri) { req.uri = Url.parse(req.url); }
var stream = FS.createWriteStream(req.uri.pathname);
stream.on('error', next);
req.pipe(stream);
req.on('end', function () {
res.writeHead(200, {});
res.end();
});
};
};

0 comments on commit 102ddb1

Please sign in to comment.