def to_msgpack(path_or_buf, *args, **kwargs):
 global compressor
 compressor = kwargs.pop('compress', None)
 if compressor:
  compressor = u(compressor)
 append = kwargs.pop('append', None)
 if append:
  mode = 'a+b'
 else:
  mode = 'wb'
 def writer(fh):
  for a in args:
   fh.write(pack(a, **kwargs))
 if isinstance(path_or_buf, compat.string_types):
  with open(path_or_buf, mode) as fh:
   writer(fh)
 elif (path_or_buf is None):
  buf = compat.BytesIO()
  writer(buf)
  return buf.getvalue()
 else:
  writer(path_or_buf)

def to_msgpack ( path_or_buf , * args , ** kwargs ) : global compressor compressor = kwargs . pop ( 'compress' , None ) if compressor : compressor = u ( compressor ) append = kwargs . pop ( 'append' , None ) if append : mode = 'a+b' else : mode = 'wb' def writer ( fh ) : for a in args : fh . write ( pack ( a , ** kwargs ) ) if isinstance ( path_or_buf , compat . string_types ) : with open ( path_or_buf , mode ) as fh : writer ( fh ) elif ( path_or_buf is None ) : buf = compat . BytesIO ( ) writer ( buf ) return buf . getvalue ( ) else : writer ( path_or_buf )
msgpack object to input file path this is an experimental library and the storage format may not be stable until a future release .