Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
squish
Advanced tools
Readme
Squish your output using whatever compression you choose.
Squish strives to be as standards compliant as possible. The spec used as a reference can be found here.
Note
This module can potentially send a 406 error (as per the spec) if the user explicitly tells it to. The only ways to do this are to set Accept-Encoding: identity;0
or to not set identity and set Accept-Encoding: *;0
. If you or your clients do that, the request shall be granted.
Disclaimer:
Squish assumes that the response hasn't been sent yet. Errors will occur if a response is started (by calling writeHead or write) and not ended. If this happens, squish will try to give you some useful info then throw an error.
As always, if something fails, create an issue. Better yet, fork and fix!
Squish intercepts all calls to write
and end
in the connect stack and applies whatever compression algoritm you pass in.
If a client does not support your algorithm, squish won't intercept or compress anything.
Here is a working example of how to use this module:
var connect = require('connect'),
compressor = require('compressor'),
squish = require('squish');
connect(
squish([{"type": 'gzip', "constructor": compressor.GzipStream}]),
connect.static('./')
).listen(8080);
Compressor is a great little utility, and it's hosted on GitHub. The best thing about it is that it's a Stream, so it's nice to work with.
Aside from what you've seen, the API is pretty simple.
There is only one parameter, an array of objects. Each object has three properties:
arguments
object, optional)On each request, squish will check each compression algorithm against the Accept-Encoding
header. The first supported compression algorithm is used. If none are supported, nothing is compressed.
If the client supports your compression, I will get rid of the 'Content-Length' header; otherwise I won't touch it.
That's it!
FAQs
Squish your outputs using whatever compression you like
The npm package squish receives a total of 2 weekly downloads. As such, squish popularity was classified as not popular.
We found that squish demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 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.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.