Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bplist-parser

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bplist-parser - npm Package Compare versions

Comparing version 0.0.6 to 0.1.0

test/utf16_chinese.plist

9

bplistParser.js

@@ -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 @@ });

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc