standalone/build-upyun-receiver-stream.js
function buildUpyunReceiverStream(opts) {
  var options = opts || {};

  _.defaults(options, {

    endpoing: 'v0',
    apiVersion: 'legacy',

    // Upload limit (in bytes)
    // defaults to ~15MB
    maxBytes: 15000000,

    // Upload limit for per coming file (in bytes)
    // falsy means no limit
    perMaxBytes: 15000000,

    // Upload limit for per file (in content-type)
    // falsy means accept all the type
    acceptTypes: null,

  });

  var receiver__ = WritableStream({ objectMode: true });

  // if onProgress handler was provided, bind an event automatically:
  if (_.isFunction(options.onProgress)) {
    receiver__.on('progress', options.onProgress);
  }

  // Track the progress of all file uploads that pass through this receiver
  // through one or more attached Upstream(s).
  receiver__._files = [];

  // This `_write` method is invoked each time a new file is received
  // from the Readable stream (Upstream) which is pumping filestreams
  // into this receiver.  (filename === `__newFile.filename`).
  receiver__._write = onFile.bind({ options });

  return receiver__;
}
function buildUpyunReceiverStream(opts) {
  var options = opts || {};

  _.defaults(options, {

    endpoing: 'v0',
    apiVersion: 'legacy',

    // Upload limit (in bytes)
    // defaults to ~15MB
    maxBytes: 15000000,

    // Upload limit for per coming file (in bytes)
    // falsy means no limit
    perMaxBytes: 15000000,

    // Upload limit for per file (in content-type)
    // falsy means accept all the type
    acceptTypes: null,

  });

  var receiver__ = WritableStream({ objectMode: true });

  // if onProgress handler was provided, bind an event automatically:
  if (_.isFunction(options.onProgress)) {
    receiver__.on('progress', options.onProgress);
  }

  // Track the progress of all file uploads that pass through this receiver
  // through one or more attached Upstream(s).
  receiver__._files = [];

  // This `_write` method is invoked each time a new file is received
  // from the Readable stream (Upstream) which is pumping filestreams
  // into this receiver.  (filename === `__newFile.filename`).
  receiver__._write = onFile.bind({ options });

  return receiver__;
}
function buildUpyunReceiverStream ( opts ) { var options = opts || { } ; _ . defaults ( options , { endpoing : 'v0' , apiVersion : 'legacy' , // Upload limit (in bytes) // defaults to ~15MB maxBytes : 15000000 , // Upload limit for per coming file (in bytes) // falsy means no limit perMaxBytes : 15000000 , // Upload limit for per file (in content-type) // falsy means accept all the type acceptTypes : null , } ) ; var receiver__ = WritableStream ( { objectMode : true } ) ; // if onProgress handler was provided, bind an event automatically: if ( _ . isFunction ( options . onProgress ) ) { receiver__ . on ( 'progress' , options . onProgress ) ; } // Track the progress of all file uploads that pass through this receiver // through one or more attached Upstream(s). receiver__ . _files = [ ] ; // This `_write` method is invoked each time a new file is received // from the Readable stream (Upstream) which is pumping filestreams // into this receiver.  (filename === `__newFile.filename`). receiver__ . _write = onFile . bind ( { options } ) ; return receiver__ ; }
A upyun receiver for Skipper that writes Upstreams to
upyun at the configured path.

@param  {Object} opts
@return {Stream.Writable}
A upyun receiver for Skipper that writes Upstreams to upyun at the configured path .