Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plist write #12

Closed
wamatt opened this issue Aug 28, 2012 · 11 comments
Closed

Plist write #12

wamatt opened this issue Aug 28, 2012 · 11 comments

Comments

@wamatt
Copy link

wamatt commented Aug 28, 2012

Anyone know if this module or any other fork supports writing to a Plist? Binary plist in particular. I wan't to update some properties in a ~/Library/Preferences plist file.

@mreinstein
Copy link
Collaborator

this might be a viable option: https://github.com/nearinfinity/node-bplist-creator

I'm thinking about including this along with node-bplist-parser

@mreinstein
Copy link
Collaborator

ascii plist writing has been merged in! Will be pushing a release to npm soon. Binary plist support is planned for inclusion soon, see issue #2

@wamatt
Copy link
Author

wamatt commented Sep 28, 2012

Awesome sauce :)

@wamatt
Copy link
Author

wamatt commented Oct 1, 2012

ascii plist writing has been merged in!

Finally got around to trying to use this now, but had a quick look and can't see it anywhere in the docs or code..

@mreinstein
Copy link
Collaborator

@wamatt I probably chose imprecise language here, what I was really indicating is that node-plist can now write xml plists via the build() function. It's in the readme.

@wamatt
Copy link
Author

wamatt commented Oct 1, 2012

Ahh ok, yeah I see I was confused too. Damn, was hoping to find something that allows search,insert,delete,update of keys, but 'spose that's quite a bit more work.

@mreinstein
Copy link
Collaborator

It would be more work to add those but I agree they would be nice to have. In my code I end up reading, modifying json, and then serializing right back to storage, so being able to treat a plist like a proper data object would be nice. Maybe add this as an enhancement ticket? Feel free to propose an API. I can't promise I'll have time to work on this at the moment but I think it would be nice to track the feature request. Maybe someone will step up and submit a pull request. :)

@wamatt
Copy link
Author

wamatt commented Oct 1, 2012

Yeah I was thinking about doing that serialize -> modify -> serialize, but I'm nervous about how safe that is. Might change something unexpectedly in the formatting. Would you use that on system files ? :)

@mreinstein
Copy link
Collaborator

It depends on the api design. Do you set it up so that insert(..), update(..), remove(...), etc immediately make changes? or instead do you have some kind of save(...) method that needs to be called?

Either way, it doesn't solve the problem of multiple processes editing a plist simultaneously.

@wamatt
Copy link
Author

wamatt commented Oct 1, 2012

Either way, it doesn't solve the problem of multiple processes editing a plist simultaneously.

True! Hadn't thought of that :p

@swapnarachapalli
Copy link

Hi,

Are these methods like insert() , delete() or update() already available ? If so can i get some example to use it ?

It will be great help for me. Also i saw in this thread that the plist can be read as json and then do the modification to this json, can u share this example ? i am newbee to scripting .

Regards,
Swapna

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants