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

fetch-node-website

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fetch-node-website - npm Package Compare versions

Comparing version 8.0.0 to 8.1.0

5

build/src/main.d.ts

@@ -21,2 +21,7 @@ import type { Stream } from 'node:stream'

progress?: boolean
/**
* Cancels the release download when the signal is aborted.
*/
signal?: AbortSignal
}

@@ -23,0 +28,0 @@

6

build/src/main.js

@@ -8,8 +8,8 @@ import{got}from"got";

const fetchNodeWebsite=async(path,opts)=>{
const{mirror,progress}=getOpts(path,opts);
const{mirror,progress,signal}=getOpts(path,opts);
const pathA=path.replace(LEADING_SLASH_REGEXP,"");
const response=await got.stream(pathA,{prefixUrl:mirror});
const response=await got.stream(pathA,{prefixUrl:mirror,signal});
addProgress(response,progress,path);
addProgress({response,progress,path,signal});

@@ -16,0 +16,0 @@ return response

@@ -8,6 +8,7 @@ import isPlainObj from"is-plain-obj";

validateBasic(path,opts);
const{progress=false,mirror=getDefaultMirror()}=opts;
const{progress=false,mirror=getDefaultMirror(),signal}=opts;
validateProgress(progress);
validateMirror(mirror);
return{progress,mirror}
validateSignal(signal);
return{progress,mirror,signal}
};

@@ -35,2 +36,8 @@

}
};
const validateSignal=(signal)=>{
if(signal!==undefined&&!(signal instanceof AbortSignal)){
throw new TypeError(`Option "signal" must be an AbortSignal: ${signal}`)
}
};

@@ -11,4 +11,4 @@ import{finished}from"node:stream/promises";

export const addProgress=async(response,progress,path)=>{
if(!progress||!showsBar()){
export const addProgress=async({response,progress,path,signal})=>{
if(!shouldShowProgress(progress,signal)){
return

@@ -24,3 +24,3 @@ }

try{
await finished(response,{writable:false})
await finished(response,{writable:false,signal})
}catch{}

@@ -55,3 +55,4 @@

const showsBar=()=>multibar.terminal.isTTY();
const shouldShowProgress=(progress,signal)=>
progress&&multibar.terminal.isTTY()&&!signal?.aborted;

@@ -58,0 +59,0 @@

{
"name": "fetch-node-website",
"version": "8.0.0",
"version": "8.1.0",
"type": "module",

@@ -57,10 +57,11 @@ "exports": {

"figures": "^5.0.0",
"got": "^12.6.0",
"got": "^13.0.0",
"is-plain-obj": "^4.1.0"
},
"devDependencies": {
"@ehmicky/dev-tasks": "^2.0.80",
"@types/node": "^18.15.3",
"sinon": "^15.0.4",
"test-each": "^5.7.1"
"@ehmicky/dev-tasks": "^2.0.88",
"@sinonjs/fake-timers": "^10.3.0",
"@types/node": "^20.4.1",
"sinon": "^15.2.0",
"test-each": "^6.0.1"
},

@@ -67,0 +68,0 @@ "engines": {

@@ -10,3 +10,3 @@ [![Node](https://img.shields.io/badge/-Node.js-808080?logo=node.js&colorA=404040&logoColor=66cc33)](https://www.npmjs.com/package/fetch-node-website)

Download release files available on
[`https://nodejs.org/dist/`](https://nodejs.org/dist/).
[`https://nodejs.org/dist/`](https://nhttps://developer.mozilla.org/en-US/docs/Web/API/AbortSignalodejs.org/dist/).

@@ -71,2 +71,9 @@ # Example

#### signal
_Type_:
[`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal)
Cancels the release download when the signal is aborted.
# See also

@@ -73,0 +80,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