Process iCloud PhotoStream in real-time

  1. Intro
  2. Information
  3. Installation
  4. Examples
  5. Release notes

Intro

Couple of days ago I released osx-photostream for node.js on Mac OSX with iCloud. It allows you to process PhotoStream uploads as they happen. You can snap a picture with your iPhone, your Mac instantly receives the photo and will notify your script for all sorts of post-processing. All within seconds.

Information

Platform:node.js
Language:javascript
Package:osx-photostream on npm
Source code:Github
Bugs & feedback:Issue tracker
License:Unlicense / Public Domain
Documentation:README.md

Installation

npm install osx-photostream

Examples

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\""');
});

Release notes

v1.1.1 – 2014-12-06 – changelog

  • Escape writeDest for mkdir

v1.1.0 – 2014-12-06 – changelog

  • Make sure copy destination exists
  • Catch uncaught exceptions
  • Improved error handling
  • Replaced for..in loop with iteration
  • New: event `watching`
  • New: fail event `watch error`
  • New: fail event `mkdir failed`

v1.0.0 – 2014-03-11 – changelog

  • First release

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *