New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

content-disposition-attachment

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

content-disposition-attachment - npm Package Compare versions

Comparing version 0.3.0 to 0.3.1

2

package.json
{
"name": "content-disposition-attachment",
"version": "0.3.0",
"version": "0.3.1",
"description": "A library to parse \"attachment\"s in Content-Disposition.",

@@ -5,0 +5,0 @@ "main": "dist/cjs/index.js",

@@ -7,4 +7,6 @@ # content-disposition-attachment

## Installation
## Getting started
### Install via npm
```sh

@@ -14,4 +16,45 @@ npm install content-disposition-attachment

## Getting Started
#### ESM
```js
import { parse } from 'content-disposition-attachment';
console.log(parse('attachment; filename=foo.html'));
// => { attachment: true, filename: 'foo.html' }
```
#### CommonJS
```js
const { parse } = require('content-disposition-attachment');
console.log(parse('attachment; filename=foo.html'));
// => { attachment: true, filename: 'foo.html' }
```
### Import from CDN
#### UMD
```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>
```
#### ESM
```html
<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>
```
## API references
### parse

@@ -31,12 +74,12 @@

parse('inline')
parse('inline');
// => { attachment: false }
parse('attachment; filename=foo.html; foo=bar')
parse('attachment; filename=foo.html; foo=bar');
// => { attachment: true, filename: 'foo.html', foo: 'bar' }
parse('attachment; foo')
parse('attachment; foo');
// => ParseError: expect '='
```
You can find more examples in the [examples directory](examples/) and the [unit tests](test/).
You can find more examples in the [unit tests](test/parse.js).
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc