bplist-parser
Advanced tools
Comparing version 0.0.6 to 0.1.0
@@ -16,2 +16,7 @@ 'use strict'; | ||
// UID object definition | ||
var UID = exports.UID = function(id) { | ||
this.UID = id; | ||
} | ||
var parseFile = exports.parseFile = function (fileNameOrBuffer, callback) { | ||
@@ -149,3 +154,3 @@ function tryParseBuffer(buffer) { | ||
if (length < exports.maxObjectSize) { | ||
return readUInt(buffer.slice(offset + 1, offset + 1 + length)); | ||
return new UID(readUInt(buffer.slice(offset + 1, offset + 1 + length))); | ||
} else { | ||
@@ -227,3 +232,3 @@ throw new Error("To little heap space available! Wanted to read " + length + " bytes, but only " + exports.maxObjectSize + " are available."); | ||
if (length < exports.maxObjectSize) { | ||
var plistString = buffer.slice(offset + stroffset, offset + stroffset + length); | ||
var plistString = new Buffer(buffer.slice(offset + stroffset, offset + stroffset + length)); | ||
if (isUtf16) { | ||
@@ -230,0 +235,0 @@ plistString = swapBytes(plistString); |
{ | ||
"name": "bplist-parser", | ||
"version": "0.0.6", | ||
"version": "0.1.0", | ||
"description": "Binary plist parser.", | ||
@@ -17,3 +17,3 @@ "main": "bplistParser.js", | ||
"devDependencies": { | ||
"nodeunit": "~0.7.4" | ||
"nodeunit": "~0.9.1" | ||
}, | ||
@@ -20,0 +20,0 @@ "repository": { |
@@ -101,2 +101,23 @@ 'use strict'; | ||
'utf16chinese': function (test) { | ||
var file = path.join(__dirname, "utf16_chinese.plist"); | ||
var startTime = new Date(); | ||
bplist.parseFile(file, function (err, dicts) { | ||
if (err) { | ||
throw err; | ||
} | ||
var endTime = new Date(); | ||
console.log('Parsed "' + file + '" in ' + (endTime - startTime) + 'ms'); | ||
var dict = dicts[0]; | ||
test.equal(dict['CFBundleName'], '天翼阅读'); | ||
test.equal(dict['CFBundleDisplayName'], '天翼阅读'); | ||
test.done(); | ||
}); | ||
}, | ||
'uid': function (test) { | ||
@@ -114,6 +135,6 @@ var file = path.join(__dirname, "uid.bplist"); | ||
var dict = dicts[0]; | ||
test.deepEqual(dict['$objects'][1]['NS.keys'], [2, 3, 4]); | ||
test.deepEqual(dict['$objects'][1]['NS.objects'], [5, 6, 7]); | ||
test.equal(dict['$top']['root'], 1); | ||
var dict = dicts[0]; | ||
test.deepEqual(dict['$objects'][1]['NS.keys'], [{UID:2}, {UID:3}, {UID:4}]); | ||
test.deepEqual(dict['$objects'][1]['NS.objects'], [{UID: 5}, {UID:6}, {UID:7}]); | ||
test.deepEqual(dict['$top']['root'], {UID:1}); | ||
test.done(); | ||
@@ -120,0 +141,0 @@ }); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
46754
12
421
7