Channel a bunch of files from a dom event into the blob store. Get some tweaks and checks made along the way.
var h =var blobFiles =var opts =stripExif: trueresize: width: 640 height: 480isPrivate: truevar fileInput =
blobFiles(files, server, opts cb)
files - an Array of files of the format delivered by file input events
server - a connection to a scuttlebot server (either an ssb-client instance, or an observeable which resolves to one)
opts - (optional) an options Object of the form:
stripExif: Boolean // (default: false) removes exif data from images (geo-location, camera meta data, etc)resize: Object // (default: undefined) resizes image if possible. Expected properties: width, heightquality: Number // (default: 0.85) tune the compression of jpegs. value between 0 and 1isPrivate: Boolean // (default: false) encrypts the blob
If a blob is private, it gets encryted and the unbox key is attached to the end of the
link property in the
result output (see
cb - a callback with signature
(err, result) which is run for each file that is processed.
The shape of the result object is
link: BlobId // hash id in the blob store, will have an unbox key on the end if isPrivate was truename: String // the filenamesize: Integer // size in bytestype: String // the MimeType