From 70df2fd232f808cfb071671a1a5c033e3dbea33c Mon Sep 17 00:00:00 2001 From: TJ Holowaychuk Date: Sun, 8 Dec 2013 10:40:01 -0800 Subject: [PATCH] add co-fs to multipart example --- multipart/app.js | 6 +++--- package.json | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/multipart/app.js b/multipart/app.js index 5a1e80f..3e5b817 100644 --- a/multipart/app.js +++ b/multipart/app.js @@ -7,8 +7,8 @@ var os = require('os'); var path = require('path'); -var fs = require('fs'); var koa = require('koa'); +var fs = require('co-fs'); var parse = require('co-busboy'); var saveTo = require('save-to'); @@ -24,7 +24,7 @@ app.use(function *(){ var tmpdir = path.join(os.tmpdir(), uid()); // make the temporary directory - yield fs.mkdir.bind(null, tmpdir); + yield fs.mkdir(tmpdir); // list of all the files var files = []; @@ -34,7 +34,7 @@ app.use(function *(){ var part; while (part = yield parts) { // filename for this part - files.push(file = path.join(tmpdir, part.filename)) + files.push(file = path.join(tmpdir, part.filename)); // save the file yield saveTo(part, file); } diff --git a/package.json b/package.json index d773fb0..f014d6e 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,8 @@ "koa-session": "koajs/session", "co-busboy": "cojs/busboy", "save-to": "~1.0.0", - "raw-body": "~1.1.1" + "raw-body": "~1.1.1", + "co-fs": "~1.1.1" }, "devDependencies": { "co": "*", @@ -25,4 +26,4 @@ "node": ">= 11.3" }, "license": "MIT" -} \ No newline at end of file +}