mirror of
https://github.com/Hopiu/fabric.js.git
synced 2026-05-19 19:01:52 +00:00
Merge pull request #828 from bernardofd/master
Replace the Streams interface with FS.readFile() in asset loading on Node.js
This commit is contained in:
commit
62740ff27b
1 changed files with 9 additions and 9 deletions
18
src/node.js
18
src/node.js
|
|
@ -57,15 +57,15 @@
|
|||
}
|
||||
|
||||
/** @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);
|
||||
function request_fs(path, callback){
|
||||
var fs = require('fs');
|
||||
fs.readFile(path, function (err, data) {
|
||||
if (err) {
|
||||
fabric.log(err);
|
||||
throw err;
|
||||
} else {
|
||||
callback(data);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue