scanFiles getExifData callback buffer PHOTOSTREAM_LOCAL_DI process env

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
scanFiles = (getExifData, callback) ->
buffer = ''
PHOTOSTREAM_LOCAL_DIR = process.env['HOME'] + '/Library/Application Support/iLifeAssetManagement/assets/sub'
find = (require 'child_process').exec('find \'' + PHOTOSTREAM_LOCAL_DIR + '\' -name \*.JPG')
find.stdout.on 'data', (data) -> buffer += data
find.on 'close', () ->
files = (file for file in (buffer.split('\n').filter (name) -> name))
callback files
tasks = require './tasks.js'
tasks.push scanFiles, (error, res) ->
log 'task finished', error, res