Permalink
Browse files

Merge branch 'master' of github.com:creationix/creationix

  • Loading branch information...
2 parents a575c51 + 8047b7f commit 102ddb152cda348b44757bf014899d1fdbb2fc39 @creationix committed Aug 11, 2011
Showing with 17 additions and 0 deletions.
  1. +1 −0 .gitignore
  2. +16 −0 uploader.js
View
@@ -0,0 +1 @@
+node_modules
View
@@ -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.