You are reading content from Scuttlebutt
@mix %lWrON0jQa8GBNnkHkhNeyTExOhES5xKik4G9QyTkVFA=.sha256

ssb-blob-files

github.com/ssbc/ssb-blob-files

Take files from DOM events, and blobify them.
This is a refactoring of the patchcore blob.html.input attachment mess

New features:

  • supports mutliple file uploads
  • doesn't add blobs > 5MB to your blob store !
var blobFiles = require('ssb-blob-files')

var fileInput = h('input', {
  type: 'file',
  attributes: { multiple: true }, // permit multiple files to be attached
  'ev-change': (ev) => {
    var files = ev.target.files
    blobFiles(files, server, { stripExif: true, isPrivate: true }, perFileCallback)
  })
})

I intend to use this for all sorts of input including :

  • drag-n-drop attachments !
  • attach a gathering image and preview it immediately

JS client maintainers ahoy! :boat:

I would like this module to be one that's easy to use, maintain, and extend.
I'd love to work with y'all and for us to use this shared module Are you on board?

cc @matt @dominic @Tim Schumacher @cryptix

I've added this to Patchbay in places of blob.html.input already, and later I'll open a PR for patchcore

@mikey %Y0cJKIHkTKAiIvbWc86a61C2gG2rORIb+P9T9alFKdc=.sha256

TIL browsers can change jpeg image quality: https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toBlob :smiley_cat:

here's a pull request, in case anyone wanted to change the .toBlob quality parameter: https://github.com/ssbc/ssb-blob-files/pull/1

@mix %ZlR/tcJXK/S81I9BsPP/8vmqCWByBxGT4MGRY5UxYuU=.sha256

connected up your work, added note to README
published as 1.1.0

Thanks @mikey!!!

@cryptix %Ic4CNU9+aYriGbV9iHr2o115azTi8ibrrtIxzZAAqpk=.sha256

@mix this looks nice! but I'm not sure I get what you ask of me...?

@mix %34byV1dv2OGOrFpRQPURqzyb9lK6aIuf8O5c/g4Z6yE=.sha256

@cryptix I don't know if you use any of patchcore, or how you handle attachments, but I'm asking if you are to consider using this instead of perpetuating that other code.

@mix %yalN5ZTnqYd+vzw3Ausl/wfZB/0qT33RsGRyVNlRQwM=.sha256

Merged into patchcore : https://github.com/ssbc/patchcore/pull/70

@cryptix %PX461pg3mo5p5VZRO80MUpDgt5siOD34LJrQCW9sMA0=.sha256

no, sorry. we don't use patchcore in tale:net

I explained around the start of the project why I chose not to. I can dig it up if you want.

@mix %rSGYKpuXAfydEFV7cWkeSvOFMCtaTL4io2bgWejODk4=.sha256

cc @regular this might be useful for your new project?

@mmckegg %e38PTVFWHbWR4GIJXjQe5mMyBnErv4rlwh3+A09Z0Yk=.sha256

@mix Just added this into Patchwork. Spawned a couple of issues:

But it looks like it's working well, otherwise.

Oh one other thing I noticed was that when I tried to attach a very large file ~200MB, it didn't return an error, but instead an unhandled error was thrown in the console (something about atob).

(testing:)

Screen Shot 2018-08-31 at 1.16.06 PM.png

@mix %BM2YItXCzMtibwEh56DLrMikScFkfo8Zi9yVbY3Bzas=.sha256

yeah I kept the crypto version at that because it was the same as what was in patchcore. I think the fix is a major version change, should come back to that.

will have a look at localisation.

Hmm I tried attaching large files like 20MB, but not 200MB, there's an atob call in async/blobify.js:

  var byteString = window.atob(dataURI.split(',')[1])

maybe it needs wrapping in a try/ catch to pass this error out? I don't know much about atob, this is another part that I ported from the existing code

Thanks for the issues!!!

@mix %xHC0t+FDNodDu8dzFE+Y1Y9FY/t64Mgnz47I/b8lIEQ=.sha256

derr ... cc @matt

User has not chosen to be hosted publicly
@cryptix %BVv4oKxaqHYwu5EXrzrUxUKvFwq/tAyjSakEYjYAAY0=.sha256

@mix et al: how would you feel about adding that remove metadata feature that @arj added to patchbay to this instead?

Join Scuttlebutt now