Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 63 lines (43 sloc) 1.561 kb
d4b2689 @mreinstein updated base64 detection regexp. updated README. hygiene.
mreinstein authored
1 # node-plist
d176df5 @TooTallNate Sloppy initial commit. Have it working up to iTunes XML files currently.
authored
2
d4b2689 @mreinstein updated base64 detection regexp. updated README. hygiene.
mreinstein authored
3 Provides facilities for reading and writing Mac OS X Plist (property list) files. These are often used in programming OS X and iOS applications, as well as the iTunes
d176df5 @TooTallNate Sloppy initial commit. Have it working up to iTunes XML files currently.
authored
4 configuration XML file.
5
d4b2689 @mreinstein updated base64 detection regexp. updated README. hygiene.
mreinstein authored
6 Plist files represent stored programming "object"s. They are very similar
7 to JSON. A valid Plist file is representable as a native JavaScript Object and vice-versa.
2ee2308 @TooTallNate Added a usage example to the README
authored
8
d4b2689 @mreinstein updated base64 detection regexp. updated README. hygiene.
mreinstein authored
9 ## Tests
10 `npm test`
2ee2308 @TooTallNate Added a usage example to the README
authored
11
d4b2689 @mreinstein updated base64 detection regexp. updated README. hygiene.
mreinstein authored
12 ## Usage
e0877a1 @mreinstein added Sync versions of calls. added deprecation warnings for old method ...
mreinstein authored
13 Parsing a plist from filename
14 ``` javascript
15 var plist = require('plist');
16
17 var obj = plist.parseFileSync('myPlist.plist');
18 console.log(JSON.stringify(obj));
19 ```
20
21 Parsing a plist from string payload
22 ``` javascript
23 var plist = require('plist');
24
25 var obj = plist.parseStringSync('<plist><string>Hello World!</string></plist>');
26 console.log(obj); // Hello World!
27 ```
28
29 Given an existing JavaScript Object, you can turn it into an XML document that complies with the plist DTD
30
31 ``` javascript
32 var plist = require('plist');
33
34 console.log(plist.build({'foo' : 'bar'}).toString());
35 ```
36
37
38
39 ### Deprecated methods
40 These functions work, but may be removed in a future release. version 0.4.x added Sync versions of these functions.
072e447 @TooTallNate Add a 'parseString' example to the README
authored
41
d4b2689 @mreinstein updated base64 detection regexp. updated README. hygiene.
mreinstein authored
42 Parsing a plist from filename
072e447 @TooTallNate Add a 'parseString' example to the README
authored
43 ``` javascript
44 var plist = require('plist');
45
46 plist.parseFile('myPlist.plist', function(err, obj) {
47 if (err) throw err;
48
49 console.log(JSON.stringify(obj));
50 });
51 ```
52
d4b2689 @mreinstein updated base64 detection regexp. updated README. hygiene.
mreinstein authored
53 Parsing a plist from string payload
072e447 @TooTallNate Add a 'parseString' example to the README
authored
54 ``` javascript
55 var plist = require('plist');
56
57 plist.parseString('<plist><string>Hello World!</string></plist>', function(err, obj) {
58 if (err) throw err;
59
d4b2689 @mreinstein updated base64 detection regexp. updated README. hygiene.
mreinstein authored
60 console.log(obj[0]); // Hello World!
072e447 @TooTallNate Add a 'parseString' example to the README
authored
61 });
62 ```
Something went wrong with that request. Please try again.