Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

digest-fetch

Package Overview
Dependencies
Maintainers
1
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

digest-fetch - npm Package Compare versions

Comparing version 3.0.0 to 3.0.1

2

package.json
{
"name": "digest-fetch",
"version": "3.0.0",
"version": "3.0.1",
"description": "digest auth request plugin for fetch/node-fetch also support http basic auth authentication",

@@ -5,0 +5,0 @@ "main": "digest-fetch-src.js",

@@ -13,12 +13,11 @@ # digest-fetch

// For digest-fetch 3.x.x or above
For digest-fetch 3.0.0 or above
```
npm install node-fetch@latest
npm install digest-fetch@latest node-fetch@latest
```
// For digest-fetch 2.0.3 or below
For digest-fetch 2.0.3 or below
```
// dependencies for node
npm install node-fetch@@v2
npm install digest-fetch@v2 node-fetch@v2

@@ -31,11 +30,39 @@ ```

// Use require for digest-fetch 2.0.3 or below
const DigestFetch = require('digest-fetch')
const DigestClient = require('digest-fetch')
// Use import
import DigestFetch from "digest-fetch"
import DigestClient from "digest-fetch"
// typescript
import DigestFetch from 'digest-fetch'
```
#### Typescript
For digest-fetch 3.0.0 or above
Since digest-fetch becomes ES module starting 3.0.0, you need to set your project as module to use import.
- Specify ```"type": "module"``` in your package.json
- Specify ```--esm``` for ts-node like ```npx ts-node --esm src/index.ts```
- Specify ```"module": "ESNext", "moduleResolution": "node"``` in your tsconfig.json
```
// Install dependencies
npm install digest-fetch@latest node-fetch@latest
// Import
import DigestClient from "digest-fetch"
```
For digest-fetch 2.0.3 or below
```
// Install dependencies
npm install digest-fetch@v2 node-fetch@v2
// Import
import DigestClient from "digest-fetch"
```
#### Http Basic Authentication

@@ -45,3 +72,3 @@ Create a client using basic authentication challenge

```
const client = new DigestFetch('user', 'password', { basic: true })
const client = new DigestClient('user', 'password', { basic: true })
client.fetch(url, options).then(res => res.json).then(console.dir)

@@ -55,3 +82,3 @@ ```

```
const client = new DigestFetch('user', 'password')
const client = new DigestClient('user', 'password')
```

@@ -62,3 +89,3 @@

```
const client = new DigestFetch('user', 'password', { algorithm: 'MD5' })
const client = new DigestClient('user', 'password', { algorithm: 'MD5' })
```

@@ -65,0 +92,0 @@

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