How to use the plist.parseStringSync function in plist

To help you get started, we’ve selected a few plist 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 AaronO / iterm-colors / index.js View on Github external
function parse(plistStr) {
    // Build JS object from plist file's data
    var pObj = plist.parseStringSync(plistStr.toString());

    // Quick function
    var get = _.partial(getColorset, pObj);

    return {
        // Special colors
        foreground: get(/Foreground Color/)[0],
        background: get(/Background Color/)[0],

        // Cursor colors
        cursor: get(/Cursor Color/)[0],
        cursor_text: get(/Cursor Text Color/)[0],

        // Standard 16 colors
        palette: get(/Ansi .*/, function(pair) {
            // "Ansi X Color"
github pwaldhauer / dayone / test / DayOneEntry.js View on Github external
var entry = new DayOneEntry();

            entry.text = 'Text';
            entry.tags = ['Tag1', 'Tag2'];
            entry.starred = true;
            entry.creationDate = new Date(1371940000000);
            entry.timezone = 'Europe/Paris';
            entry.music = {
                Album: 'AM',
                Artist: 'Arctic Monkeys',
                Track: 'Do I Wanna Know?'
            };

            var outPlist = entry.toOutputFormat();

            var parsed = plist.parseStringSync(outPlist);

            assert.equal(parsed['UUID'], entry.UUID);
            assert.equal(parsed['Entry Text'], entry.text);
            assert.deepEqual(parsed['Tags'], entry.tags);
            assert.equal(parsed['Starred'], entry.starred);
            assert.equal(parsed['Creation Date'].getTime(), entry.creationDate.getTime());
            assert.equal(parsed['Time Zone'], entry.timezone);
            assert.deepEqual(parsed['Music'], entry.music);

            done();
        });
github rborn / SugarTi / commands.js View on Github external
fs.readdir(PROFILES_DIR, function(err, files) {
		if (err !== null) {
			callback(true, 'Error searching for provisioning profiles');
			return;
		}

		var found_profile =  false;

		for (var i = 0; i < files.length; i++) {
			if (files[i] !== '.DS_Store') {
				var xml = fs.readFileSync(PROFILES_DIR + files[i], 'utf8'),
					parsed_plist = plist.parseStringSync(xml.substring(xml.indexOf('') + 8)),
					PlistAppIdPrefix = parsed_plist.ApplicationIdentifierPrefix,
					PlistAppId = parsed_plist.Entitlements['application-identifier'],
					PlistProfile = PlistAppId.replace(PlistAppIdPrefix + '.', '').replace('.*', '');

				if (id.indexOf(PlistProfile) >= 0) {
					if (new Date() > new Date(parsed_plist.ExpirationDate)) {
						console.log(('Found an EXPIRED matching profile: ' + parsed_plist.Name.inverse + ' => ' + PlistAppId.inverse));
						console.log('Trying to find another profile...');
					} else {
						console.log(('Found a VALID matching profile: "' + parsed_plist.Name.inverse + '" => ' + PlistAppId.inverse + '\nTrying with this one...\n\n').green);
						callback(null, files[i].substring(0, files[i].indexOf('.')));
						found_profile = true;
						break;
					}
				}
			}
github gameclosure / native-ios / lib / updatePlist.js View on Github external
function Plist(filename) {
  this._filename = filename;
  try {
    var rawPlist = fs.readFileSync(filename, 'utf-8');
    var plistObj = plist.parseStringSync(rawPlist);
    this._plist = plistObj;
  } catch (e) {
    console.error(e);
    throw new Error('Cannot read ' + this._filename);
  }
}

plist

Apple's property list parser/builder for Node.js and browsers

MIT
Latest version published 1 year ago

Package Health Score

74 / 100
Full package analysis