Giter Club home page Giter Club logo

node-simple-plist's Introduction

node-simple-plist

npm npm Travis (.com) branch

A simple API for interacting with binary and plain text plist data.

Installation

$ npm install simple-plist

Reading Data

var plist = require('simple-plist')

// Read data from a file (xml or binary) (asynchronous)
plist.readFile('/path/to/some.plist', function(err, data) {
  if (err) {
    throw err
  }
  console.log(JSON.stringify(data))
})

// Read data from a file (xml or binary) (synchronous)
var data = plist.readFileSync('/path/to/some.plist')
console.log(JSON.stringify(data))

Writing Data

var plist = require('simple-plist'),
  data = plist.readFileSync('/path/to/some.plist')

// Write data to a xml file (asynchronous)
plist.writeFile('/path/to/plaintext.plist', data, function(err) {
  if (err) {
    throw err
  }
})

// Write data to a xml file (synchronous)
plist.writeFileSync('/path/to/plaintext.plist', data)

// Write data to a binary plist file (asynchronous)
plist.writeBinaryFile('/path/to/binary.plist', data, function(err) {
  if (err) {
    throw err
  }
})

// Write data to a binary plist file (synchronous)
plist.writeBinaryFileSync('/path/to/binary.plist', data)

Mutating Plists In Memory

var plist = require('simple-plist')

// Convert a Javascript object to a plist xml string
var xml = plist.stringify({ name: 'Joe', answer: 42 })
console.log(xml) // output is a valid plist xml string

// Convert a plist xml string or a binary plist buffer to a Javascript object
var data = plist.parse(
  '<plist><dict><key>name</key><string>Joe</string></dict></plist>'
)
console.log(JSON.stringify(data))

node-simple-plist's People

Contributors

wollardj avatar dependabot[bot] avatar matiassingers avatar trufae avatar dnicolson avatar edbrannin avatar nicolashenry avatar r-murphy avatar tonylukasavage avatar vweevers avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.