Permalink
Browse files

parse human-readable sizes into numbers (fixes #2)

use filesize-parser to parse things like "5 MiB" into numbers for our
electricity-bound friends, computers
  • Loading branch information...
1 parent fe68233 commit f257371985b964c8528cd5349fd92351c9a78ee4 @deoxxa committed Sep 8, 2013
Showing with 15 additions and 5 deletions.
  1. +6 −0 lib/mediainfo.js
  2. +9 −5 package.json
View
@@ -1,4 +1,5 @@
var child_process = require("child_process"),
+ filesizeParser = require("filesize-parser"),
expat = require("node-expat");
module.exports = function() {
@@ -59,7 +60,12 @@ module.exports = function() {
}
if (file !== null && name === "file") {
+ if (file.file_size) {
+ file.file_size_bytes = filesizeParser(file.file_size);
+ }
+
files.push(file);
+
file = null;
}
View
@@ -8,9 +8,12 @@
"url": "http://www.fknsrs.biz/"
},
"url": "http://github.com/deoxxa/node-mediainfo",
- "license" : "BSD",
- "repository" : { "type":"git", "url":"git://github.com/deoxxa/node-mediainfo.git" },
- "keywords" : [
+ "license": "BSD",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/deoxxa/node-mediainfo.git"
+ },
+ "keywords": [
"mediainfo",
"media",
"audio",
@@ -23,9 +26,10 @@
],
"main": "./lib/mediainfo",
"engines": {
- "node" : ">=0.6.11"
+ "node": ">=0.6.11"
},
"dependencies": {
- "node-expat": "2.0.x"
+ "node-expat": "2.0.x",
+ "filesize-parser": "~0.0.2"
}
}

0 comments on commit f257371

Please sign in to comment.