
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
content-disposition-attachment
Advanced tools
A library to parse "attachment"s in Content-Disposition.
A library to parse "attachment"s in Content-Disposition.
npm install content-disposition-attachment
import { parse } from 'content-disposition-attachment';
console.log(parse('attachment; filename=foo.html'));
// => { attachment: true, filename: 'foo.html' }
const { parse } = require('content-disposition-attachment');
console.log(parse('attachment; filename=foo.html'));
// => { attachment: true, filename: 'foo.html' }
<script src="https://unpkg.com/content-disposition-attachment@0.3"></script>
<script>
console.log(ContentDispositionAttachment.parse('attachment; filename="foo.html"'));
// => { attachment: true, filename: 'foo.html' }
</script>
<script type="module">
import { parse } from 'https://unpkg.com/content-disposition-attachment@0.3?module';
console.log(parse('attachment; filename=foo.html'));
// => { attachment: true, filename: 'foo.html' }
</script>
Parse a Content-Disposition.
If Content-Disposition is not "attachment", it returns { attachment: false }
;
otherwise, it returns { attachment: true }
along with parsed parameters.
If errors occur when parsing parameters, a ParseError
will be thrown.
Examples
import { parse } from 'content-disposition-attachment';
parse('inline');
// => { attachment: false }
parse('attachment; filename=foo.html; foo=bar');
// => { attachment: true, filename: 'foo.html', foo: 'bar' }
parse('attachment; foo');
// => ParseError: expect '='
You can find more examples in the unit tests.
FAQs
A library to parse "attachment"s in Content-Disposition.
The npm package content-disposition-attachment receives a total of 4,295 weekly downloads. As such, content-disposition-attachment popularity was classified as popular.
We found that content-disposition-attachment demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.