Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
minipass-fetch
Advanced tools
An implementation of window.fetch in Node.js using Minipass streams
The minipass-fetch npm package is a light-weight implementation of the window.fetch API built on top of the minipass stream library. It is designed to be a smaller, stream-based alternative to the larger fetch implementations, allowing for efficient data handling and manipulation in Node.js environments.
Performing HTTP GET requests
This feature allows you to perform HTTP GET requests to retrieve data from a specified URL. The response can be processed as JSON.
const fetch = require('minipass-fetch');
fetch('https://api.example.com/data')
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
Performing HTTP POST requests
This feature allows you to perform HTTP POST requests to send data to a server. You can include headers and a body in the request.
const fetch = require('minipass-fetch');
fetch('https://api.example.com/submit', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ key: 'value' })
})
.then(response => response.json())
.then(data => console.log('Success:', data))
.catch(error => console.error('Error:', error));
Streaming response data
This feature leverages the streaming capabilities of minipass-fetch to handle large amounts of data without buffering it all in memory at once.
const fetch = require('minipass-fetch');
const { PassThrough } = require('stream');
fetch('https://api.example.com/large-data')
.then(response => {
const stream = new PassThrough();
response.body.pipe(stream);
stream.on('data', chunk => console.log(chunk.toString()));
})
.catch(error => console.error('Error:', error));
node-fetch is a light-weight module that brings the Fetch API to Node.js. It is similar to minipass-fetch but does not focus on streaming data and may not be as minimal in size.
axios is a promise-based HTTP client for the browser and Node.js. It provides a more feature-rich API compared to minipass-fetch, including interceptors, automatic transforms for JSON data, and client-side protection against XSRF.
got is a human-friendly and powerful HTTP request library for Node.js. It offers advanced features like retries, streams, and convenient JSON handling, which can make it a more comprehensive alternative to minipass-fetch.
An implementation of window.fetch in Node.js using Minipass streams
This is a fork (or more precisely, a reimplementation) of node-fetch. All streams have been replaced with minipass streams.
The goal of this module is to stay in sync with the API presented by
node-fetch
, with the exception of the streaming interface provided.
Minipass streams are faster and more deterministic in their timing contract than node-core streams, making them a better fit for many server-side use cases.
See node-fetch
Differences from node-fetch
(and, by extension, from the WhatWG Fetch
specification):
https.request()
when making https
requests.4.0.0 (2024-09-05)
minipass-fetch
now supports node ^18.17.0 || >=20.5.0
f59d139
#160 bump @npmcli/eslint-config from 4.0.5 to 5.0.0 (@dependabot[bot])8e696c6
#161 run template-oss-apply (@hashtagchris)4a7fb89
#149 tests NODE_TLS_REJECT_UNAUTHORIZED (#149) (@reggi)7f99262
#163 postinstall for dependabot template-oss PR (@hashtagchris)21fcdc0
#163 bump @npmcli/template-oss from 4.22.0 to 4.23.3 (@dependabot[bot])FAQs
An implementation of window.fetch in Node.js using Minipass streams
The npm package minipass-fetch receives a total of 15,752,835 weekly downloads. As such, minipass-fetch popularity was classified as popular.
We found that minipass-fetch demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 6 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
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.