ssb-blobs-blurhash
v0.0.3
Published
SSB secret stack plugin to generate a blurhash hash for a provided blob
Downloads
4
Readme
ssb-blobs-blurhash
SSB secret stack plugin to generate a blurhash hash for a provided blob
Install
npm install ssb-blobs-blurhash
Usage
- Requires Node 12 or higher
- Requires
ssb-blobs
SecretStack({appKey: require('ssb-caps').shs})
+ .use(require('ssb-blobs'))
+ .use(require('ssb-blobs-blurhash'))
.call(null, config)
API
ssb.blobsBlurhash.generate(blobId, opts, cb) (muxrpc "async")
blobId: string
: ssb blob idopts: { width: number, details }
: options to use for generation.width
is the pixel width to resize your blob image to, for generating the hash. The smaller this number is, the quicker the algorithm will run, but with lower quality. The higher this number is, the higher the quality and the slower the algorithm will run.details
is a boolean that determines whether to return the hash (iffalse
) or an object{hash, componentX, componentY}
(iftrue
)
cb: (err: any, hash: string) => void
: callback that provides the hash generated by blurhash
ssb.blobsBlurHash.generate('abc123', { width: 48 }, (err, hash) => {
if (err) throw err
console.log(`Blurhash result is ${hash}`)
})
License
MIT