How to use bplist-parser - 10 common examples

To help you get started, we’ve selected a few bplist-parser examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github motioncrypto / masternode-installer / src / renderer / components / LandingPage.vue View on Github external
'0777', (err) => {
        if (err) {
          console.log(err);
        }

        if (os.platform() === 'darwin') {
          if (existsSync(`${os.userInfo().homedir}/Library/Preferences/org.motion.Motion-Qt.plist`)) {
            bplist.parseFile(`${os.userInfo().homedir}/Library/Preferences/org.motion.Motion-Qt.plist`, (err, plistData) => {
              if (err) throw err;

              this.$store.commit('SET_MNCONFPATH', {
                mnConfPath: plistData[0].strDataDir,
              });
              this.runDaemon();
            });
          } else {
            this.runDaemon();
          }
        } else if (os.platform() === 'win32') {
          // regedit.list('HKCU\\SOFTWARE\\MOTION\\MOTION-QT', (err, registryData) => {
          //   if (err) throw err;

          //   this.$store.commit('SET_MNCONFPATH', {
          //     mnConfPath: registryData[Object.keys(registryData)[0]].values.strDataDir.value,
github watson / airplay-protocol / index.js View on Github external
res.on('end', function () {
      var body = Buffer.concat(buffers)

      switch (res.headers['content-type']) {
        case 'application/x-apple-binary-plist':
          body = bplistDecode(body)[0]
          break
        case 'text/x-apple-plist+xml':
          body = plist.parse(body.toString())
          break
        case 'text/parameters':
          body = body.toString().trim().split('\n').reduce(function (body, line) {
            line = line.split(': ')
            // TODO: For now it's only floats, but it might be better to not expect that
            body[line[0]] = parseFloat(line[1], 10)
            return body
          }, {})
          break
      }

      cb(err, res, body)
    })
github leftlogic / remote-debug / safari / plist.js View on Github external
read_pos += 4;

    // Is there enough data here?
    // If not, jump back to our original position and gtfo
    if( recieved.length < msg_length + read_pos ) {
      read_pos = old_read_pos;
      break;
    }

    // Extract the main body of the message (where the plist should be)
    var body = recieved.slice(read_pos, msg_length + read_pos);

    // Extract the plist
    var plist;
    try {
      plist = bplist_parse.parseBuffer(body);
    } catch (e) {
      console.log(e);
    }

    // bplist_parse.parseBuffer returns an array
    if( plist.length === 1 ) {
      plist = plist[0];
    }

    log();
    log('plist ===================================='.green);
    log();
    log(
      util.inspect(plist, false, null)
    );
    log();
github leftlogic / remote-debug / safari / tcpdump-to-buffer.js View on Github external
data.push(second);
    }
  }
});

// console.log(data.join(','));
console.log(data.length);

var buf = new Buffer(data.slice(8));

console.log(buf);
console.log(buf.length);

var plist;
try {
  plist = bplist_parse.parseBuffer(buf);
} catch (e) {
  console.log(e);
}

console.log(util.inspect(plist, false, null));

if( plist[0].__argument.WIRSocketDataKey ) {
  console.log(plist[0].__argument.WIRSocketDataKey.toString());
}
if( plist[0].__argument.WIRMessageDataKey ) {
  console.log(plist[0].__argument.WIRMessageDataKey.toString());
}
github appium / appium / lib / devices / ios / remote-debugger.js View on Github external
// Jump forward 4 bytes
    this.readPos += 4;

    // Is there enough data here?
    // If not, jump back to our original position and gtfo
    if (this.received.length < msgLength + this.readPos) {
      this.readPos = oldReadPos;
      break;
    }

    // Extract the main body of the message (where the plist should be)
    body = this.received.slice(this.readPos, msgLength + this.readPos);

    // Extract the plist
    try {
      plist = bplistParse.parseBuffer(body);
    } catch (e) {
      this.logger.error("Error parsing binary plist");
      this.logger.debug(e);
    }

    // bplistParse.parseBuffer returns an array
    if (plist.length === 1) {
      plist = plist[0];
    }

    var plistCopy = plist;
    if (typeof plistCopy.WIRMessageDataKey !== "undefined") {
      plistCopy.WIRMessageDataKey = plistCopy.WIRMessageDataKey.toString("utf8");
    }
    if (typeof plistCopy.WIRDestinationKey !== "undefined") {
      plistCopy.WIRDestinationKey = plistCopy.WIRDestinationKey.toString("utf8");
github alan-ai / alan-sdk-reactnative / testtools / node_modules / simple-plist / simple-plist.js View on Github external
function parse(aStringOrBuffer, aFile) {
  const firstByte = aStringOrBuffer[0]
  let results
  try {
    if (firstByte === 60 || firstByte === '<') {
      results = plist.parse(aStringOrBuffer.toString())
    } else if (firstByte === 98) {
      ;[results] = bplistParser.parseBuffer(aStringOrBuffer)
    } else if (aFile != null) {
      throw new Error(`Unable to determine format for '${aFile}'`)
    } else {
      throw new Error('Unable to determine format for plist aStringOrBuffer')
    }
  } catch (error) {
    throw new Error(error)
  }
  return results
}
github appcelerator / titanium_mobile / node_modules / ioslib / node_modules / simple-plist / simple-plist.js View on Github external
exports.readFileSync = function(aFile) {
	var results,
		contents = fs.readFileSync(aFile),
		firstByte = contents[0];

	if (contents.length === 0) {
		console.error("Unable to read file '%s'", aFile);
		return {};
	}

	try {
		if (firstByte === 60) {
			results = plist.parse(contents.toString());
		}
		else if (firstByte === 98) {
			results = bplistParser.parseBuffer(contents)[0];
		}
		else {
			console.error("Unable to determine format for '%s'", aFile);
			results = {};
		}
	}
	catch(e) {
		throw Error("'%s' has errors", aFile);
	}
	return results;
};
github nowsecure / airspy / bin / airspy.ts View on Github external
private parseBody(body: Buffer): string {
        const [ root ] = bplist.parseBuffer(body);

        return plist.build(root);
    }
github wollardj / node-simple-plist / simple-plist.js View on Github external
function parse(aStringOrBuffer, aFile) {
  const firstByte = aStringOrBuffer[0]
  let results
  try {
    if (firstByte === 60 || firstByte === '<') {
      results = plist.parse(aStringOrBuffer.toString())
    } else if (firstByte === 98) {
      ;[results] = bplistParser.parseBuffer(aStringOrBuffer)
    } else if (aFile != null) {
      throw new Error(`Unable to determine format for '${aFile}'`)
    } else {
      throw new Error('Unable to determine format for plist aStringOrBuffer')
    }
  } catch (error) {
    throw new Error(error)
  }
  return results
}
github xinyu198736 / sketch-to-html / parser / styleParser.js View on Github external
function parseArchive (base64String) {
    const buf2 = Buffer.from(base64String, 'base64');
    const obj = bplistParser.parseBuffer(buf2);
    const parser = new NSArchiveParser();
    return parser.parse(obj);
}
module.exports = styleParser;

bplist-parser

Binary plist parser.

MIT
Latest version published 3 years ago

Package Health Score

70 / 100
Full package analysis

Popular bplist-parser functions