ssb-blob-files
Channel a bunch of files from a dom event into the blob store. Get some tweaks and checks made along the way.
Usage
var h = var blobFiles = var opts = stripExif: true resize: width: 640 height: 480 isPrivate: true var fileInput =
API
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, height quality: Number // (default: 0.85) tune the compression of jpegs. value between 0 and 1 isPrivate: 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
details)
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 true name: String // the filename size: Integer // size in bytes type: String // the MimeType