lib/api/resources.js
function(file, options, callback) {
            // If the file is a string, we assume it's a path on disk
            if (_.isString(file)) {
                try {
                    file = fs.createReadStream(file);
                } catch (err) {
                    return callback({'message': 'A stream could not be opened for the provided path', 'err': err});
                }
            }

            // Attach an error listener to the stream
            file.on('error', function(err) {
                return callback({'message': 'An error occurred when reading from the stream', 'err': err});
            });

            // Upload the file
            var data = {'file': file};
            addSizes(data, options, 'thumbnailSizes');
            addSizes(data, options, 'imageSizes');
            return processr._request('POST', '/resources', data, callback);
        }
function(file, options, callback) {
            // If the file is a string, we assume it's a path on disk
            if (_.isString(file)) {
                try {
                    file = fs.createReadStream(file);
                } catch (err) {
                    return callback({'message': 'A stream could not be opened for the provided path', 'err': err});
                }
            }

            // Attach an error listener to the stream
            file.on('error', function(err) {
                return callback({'message': 'An error occurred when reading from the stream', 'err': err});
            });

            // Upload the file
            var data = {'file': file};
            addSizes(data, options, 'thumbnailSizes');
            addSizes(data, options, 'imageSizes');
            return processr._request('POST', '/resources', data, callback);
        }
function ( file , options , callback ) { // If the file is a string, we assume it's a path on disk if ( _ . isString ( file ) ) { try { file = fs . createReadStream ( file ) ; } catch ( err ) { return callback ( { 'message' : 'A stream could not be opened for the provided path' , 'err' : err } ) ; } } // Attach an error listener to the stream file . on ( 'error' , function ( err ) { return callback ( { 'message' : 'An error occurred when reading from the stream' , 'err' : err } ) ; } ) ; // Upload the file var data = { 'file' : file } ; addSizes ( data , options , 'thumbnailSizes' ) ; addSizes ( data , options , 'imageSizes' ) ; return processr . _request ( 'POST' , '/resources' , data , callback ) ; }
Create and process a file

@param  {stream}     file                            A stream that holds the data for a file that should be uploaded and processed
@param  {Object}     [options]                       A set of extra options
@param  {string[]}   [options.thumbnailSizes]        A set of thumbnail dimensions
@param  {string[]}   [options.imageSizes]            A set of image dimensions
@param  {Function}   callback                        Standard callback function
@param  {Error}      callback.err                    The error object as returned by the REST API. If no error occurred, this value will be `null`
@param  {Object}     callback.data                   The data as returned by the REST API. If the request errored, this value will be `null`
Create and process a file