Skip to content
Browse files

[fix] Changed require('sys') to require('util') for compatibility wit…

…h node v0.8
  • Loading branch information...
1 parent 158a638 commit 15fe2d984bfb2db74814e6ccc2829064b53d0826 @blakmatrix blakmatrix committed Jun 22, 2012
Showing with 15 additions and 15 deletions.
  1. +15 −15 test.js
View
30 test.js
@@ -1,28 +1,28 @@
-var sys = require('sys'),
+var util = require('util'),
fs = require('fs'),
im = require('./imagemagick');
var path = 'sample-images/jpeg5.jpg';
var imdata = fs.readFileSync(path, 'binary');
im.identify(path, function(err, features){
- if (err) return sys.error(err.stack || err);
- sys.puts('features: '+sys.inspect(features));
+ if (err) return util.error(err.stack || err);
+ util.puts('features: '+util.inspect(features));
})
im.identify({data:imdata}, function(err, features){
- if (err) return sys.error(err.stack || err);
- sys.puts('features: '+sys.inspect(features));
+ if (err) return util.error(err.stack || err);
+ util.puts('features: '+util.inspect(features));
})
im.readMetadata(path, function(err, metadata){
- if (err) return sys.error(err.stack || err);
- sys.puts('metadata: '+sys.inspect(metadata));
+ if (err) return util.error(err.stack || err);
+ util.puts('metadata: '+util.inspect(metadata));
})
im.readMetadata({data:imdata}, function(err, metadata){
- if (err) return sys.error(err.stack || err);
- sys.puts('metadata: '+sys.inspect(metadata));
+ if (err) return util.error(err.stack || err);
+ util.puts('metadata: '+util.inspect(metadata));
})
var timeStarted = new Date;
@@ -31,11 +31,11 @@ im.resize({
dstPath: path+'.resized.jpg',
width: 256
}, function(err, stdout, stderr){
- if (err) return sys.error(err.stack || err);
- sys.puts('real time taken for convert: '+((new Date)-timeStarted)+' ms')
+ if (err) return util.error(err.stack || err);
+ util.puts('real time taken for convert: '+((new Date)-timeStarted)+' ms')
im.identify(['-format', '%b', path+'.resized.jpg'], function(err, r){
if (err) throw err;
- sys.puts('size: '+r.substr(0,r.length-2)+' Bytes');
+ util.puts('size: '+r.substr(0,r.length-2)+' Bytes');
})
})
@@ -44,8 +44,8 @@ im.resize({
srcData: imdata,
width: 256
}, function(err, stdout, stderr){
- if (err) return sys.error(err.stack || err);
- sys.puts('real time taken for convert (with buffers): '+((new Date)-timeStarted)+' ms');
+ if (err) return util.error(err.stack || err);
+ util.puts('real time taken for convert (with buffers): '+((new Date)-timeStarted)+' ms');
fs.writeFileSync(path+'.resized-io.jpg', stdout, 'binary');
- sys.puts('size: '+stdout.length+' Bytes');
+ util.puts('size: '+stdout.length+' Bytes');
})

0 comments on commit 15fe2d9

Please sign in to comment.
Something went wrong with that request. Please try again.