diff --git a/examples/fromFile.js b/examples/fromFile.js
index 1565afe1..8f1fb720 100644
--- a/examples/fromFile.js
+++ b/examples/fromFile.js
@@ -10,18 +10,22 @@ svgo
.then(function(result) {
console.log(result);
- // output:
- // {
- // // optimized SVG data string
- // data: ''
- // // additional info such as width/height and start/end bytes length
- // info: {
- // width: '10',
- // height: '20',
- // inBytes: 59,
- // outBytes: 38
- // }
- // }
+ /*
+ output:
+
+ {
+ // optimized SVG data string
+ data: ''
+ // additional info such as width/height and start/end bytes length
+ info: {
+ width: '10',
+ height: '20',
+ inBytes: 59,
+ outBytes: 38,
+ time: N
+ }
+ }
+ */
})
// end promises chain
diff --git a/examples/fromStream.js b/examples/fromStream.js
index 4840163e..e332e97e 100644
--- a/examples/fromStream.js
+++ b/examples/fromStream.js
@@ -15,18 +15,22 @@ svgo
.then(function(result) {
console.log(result);
- // output:
- // {
- // // optimized SVG data string
- // data: ''
- // // additional info such as width/height and start/end bytes length
- // info: {
- // width: '10',
- // height: '20',
- // inBytes: 59,
- // outBytes: 38
- // }
- // }
+ /*
+ output:
+
+ {
+ // optimized SVG data string
+ data: ''
+ // additional info such as width/height and start/end bytes length
+ info: {
+ width: '10',
+ height: '20',
+ inBytes: 59,
+ outBytes: 38,
+ time: N
+ }
+ }
+ */
})
// end promises chain
diff --git a/examples/fromString.js b/examples/fromString.js
index 1c371090..2c7e48c9 100644
--- a/examples/fromString.js
+++ b/examples/fromString.js
@@ -10,18 +10,22 @@ svgo
.then(function(result) {
console.log(result);
- // output:
- // {
- // // optimized SVG data string
- // data: ''
- // // additional info such as width/height and start/end bytes length
- // info: {
- // width: '10',
- // height: '20',
- // inBytes: 52,
- // outBytes: 38
- // }
- // }
+ /*
+ output:
+
+ {
+ // optimized SVG data string
+ data: ''
+ // additional info such as width/height and start/end bytes length
+ info: {
+ width: '10',
+ height: '20',
+ inBytes: 52,
+ outBytes: 38,
+ time: N
+ }
+ }
+ */
})
// end promises chain
diff --git a/lib/svgo.js b/lib/svgo.js
index 8a9db98b..845671fa 100644
--- a/lib/svgo.js
+++ b/lib/svgo.js
@@ -48,6 +48,8 @@ module.exports = INHERIT(/** @lends SVGO.prototype */{
*/
fromString: function(str) {
+ var startTime = Date.now();
+
str = decodeSVGDatauri(str);
return this.config
@@ -61,6 +63,8 @@ module.exports = INHERIT(/** @lends SVGO.prototype */{
result.info.inBytes = Buffer.byteLength(str, 'utf-8');
result.info.outBytes = Buffer.byteLength(result.data, 'utf-8');
+ result.info.time = Date.now() - startTime;
+
return result;
});