
Product
Introducing Socket Firewall Enterprise: Flexible, Configurable Protection for Modern Package Ecosystems
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.
multiblob-http
Advanced tools
serve content-addressed blobs over http. see use with [multiblob](https://github.com/ssbc/multiblob)
serve content-addressed blobs over http. see use with multiblob
var MultiBlob = require('multiblob')
var MultiBlobHttp = require('multiblob-http')
var http = require('http')
var dir = where_files_go //set this.
var blobs = MultiBlob(dir)
http.createServer(MultiBlobHttp(blobs, '/blobs')).listen(8000)
this will return an http handler (compatible with express middleware) that will handle requests
GET /blobs/get/{id}POST /blobs/add (which will respond with the hash)you can also set a different prefix, but I use /blobs
retrive blob with hash {id}
posts to add do not require to have a hash, but will respond with the hash. (TODO: take a POST to /add/{id} and error if received content did not have that hash)
multiblobs-http provides the correct headers to make serving content-addressed
files as efficient as possible.
First the the etag header is set to the hash and the expires header is set to a year in the future.
Ideally, the browser shouldn't request this resource again for a whole year.
Probably it might revalidate it when someone uses ctrl-R to reload the page.
When it does, it will request with if-none-modified set to the hash.
Since content-addressed files are never modified, the server immediately responds
with 304 (not modified)
the content-length header is always used unless "opts.size=false".
This way, if a connection fails somehow,
or there is an error later, the browser should detect it.
Of course, it would be way better if browsers just understood content-hashes.
But, we have to play the hand we where delt, and
multiblob-http makes the most of the broken web we live in.
MIT
FAQs
serve content-addressed blobs over http
The npm package multiblob-http receives a total of 717 weekly downloads. As such, multiblob-http popularity was classified as not popular.
We found that multiblob-http demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.

Product
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.