Skip to content

Instantly share code, notes, and snippets.

@fvdm fvdm/icloud_photostream.js
Last active Jan 27, 2016

Embed
What would you like to do?
// Only copy new images to another folder:
require ('osx-photostream') ('~/Pictures/iCloud');
// Do more stuff with them:
var ps = require ('osx-photostream') ();
ps.on ('update', function (file) {
console.log ('New image added: ' + file.filename);
};)
// Or do both and first copy to another folder,
// then tell another app a new image is ready using AppleScript.
var ps = require ('osx-photostream') ('~/Pictures/iCloud');
var exec = require ('child_process').exec;
ps.on ('copy', function (file) {
// Forward image to friend
exec ('osascript -e "tell application \"Messages\" to send POSIX file \"' + file.copypath + '\" to buddy \"friend@email.tld\" of service \"E:my@email.tld\""');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.