Process new PhotoStream photos in realtime with iCloud on OSX
Process new images in real-time with iCloud PhotoStream on OSX.
This node.js module can run in the background to listen (kqueue) for new images in your PhotoStream on iCloud. You can snap a photo with your iPhone and within moments have your Mac archive it to another folder or do other post-processing with it.
The release on npm is always the latest stable version:
npm install osx-photostream
The code in the Github repository is the most recent, but can be unstable:
npm install fvdm/nodejs-osx-photostream
There are two ways to use this module, these can be combined:
Very useful if you prefer apps like Picasa over iPhoto. For example, to archive photos before iCloud expires them after 30 days.
var ps = require'osx-photostream''~/Pictures/iCloud'
var ps = require'osx-photostream'pson 'update'console.log'New image added: '+ filefilename
var ps = require'osx-photostream''~/Pictures/iCloud'var exec = require'child_process'execpson 'copy'// Forward image to friend with iMessageexec'osascript -e "tell application \"Messages\" to send POSIX file \"'+ filecopypath +'\" to buddy \"firstname.lastname@example.org\" of service \"E:email@example.com\""'
A new file was added to your PhotoStream.
pson 'update'console.log 'New image: '+ filefilename
A new file was copied from PhotoStream to the other folder.
This event is only triggered when a destination path is set and the copy succeeded.
pson 'copy'// tell another app or module the image at file.copypath is ready.
The app is watching
watchPath for updates.
pson 'watching'console.log 'Watching PhotoStream'
An error occured. You can safely ignore this event, but it may help in times of trouble.
|reason||See table below.|
|error||The error as reported.|
pson 'fail'console.log 'ERROR: '+ reason +' - '+ filefilenameconsole.log error
|watch error||Something went wrong during watching|
|readdir failed||New item can not be read|
|mkdir failed||Can not create copy destination|
|copy failed||Can not copy new file to destination|
|.pathname||Path to your PhotoStream location|
|.filename||Filename of the new file, i.e. IMG_5778.PNG|
|.fullpath||.pathname +'/'+ .filename|
|.copypath||If copied, new location with filename|
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.
In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to http://unlicense.org