From 67d1a4732c60011e649423a22fa54438146bcebf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernardo=20Figuer=C3=AAdo=20Domingues?= Date: Fri, 6 Sep 2013 11:36:09 -0300 Subject: [PATCH 1/2] Replacing Streams interface for FS.readFile to load assets in the Node.js module --- src/node.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/node.js b/src/node.js index 490d6b65..c3d1ec48 100644 --- a/src/node.js +++ b/src/node.js @@ -58,14 +58,14 @@ /** @private */ function request_fs(url, callback){ - var fs = require('fs'), - stream = fs.createReadStream(url), - body = ''; - stream.on('data', function(chunk){ - body += chunk; - }); - stream.on('end', function(){ - callback(body); + var fs = require('fs'); + fs.readFile(url, function (err, data) { + if (err) { + fabric.log(err); + throw err; + } else { + callback(data); + } }); } From 806a44e3c386da322a25846fc447e5439c37d319 Mon Sep 17 00:00:00 2001 From: "Bernardo F. Domingues" Date: Fri, 6 Sep 2013 11:39:28 -0300 Subject: [PATCH 2/2] Renaming "url" to "path" for clarity reasons --- src/node.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/node.js b/src/node.js index c3d1ec48..962b36ba 100644 --- a/src/node.js +++ b/src/node.js @@ -57,9 +57,9 @@ } /** @private */ - function request_fs(url, callback){ + function request_fs(path, callback){ var fs = require('fs'); - fs.readFile(url, function (err, data) { + fs.readFile(path, function (err, data) { if (err) { fabric.log(err); throw err;