Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@wezz/fetchmanager
Advanced tools
A script that improves a javascript fetch requests with request throttling, managing querystring parameters and delayed request start
This is a script to ease the use of making fetch requests. It features the ability to stop consequetive requests, delay a request and parse querystrings from JSON.
npm install @wezz/fetchmanager
import { FetchManager } from '@wezz/fetchmanager';
// On document ready
const response = fetchManager.Fetch({
"url": "urlhere"
});
const data = response.json();
When doing a fetch request you should define a options object that looks like this:
{
"key": "unique request key",
"url": "https://requesturl.com"
"querystring": { "querystringkey": "querystringvalue" },
"requestdelay": 0,
"cache": false,
"fetchoptions": null,
"json": true
}
Note that the option fetchoptions is passed down directly to fetch.
Click here for the fetch options documentation
If a key is set then the "signal" will be stored and if another request is being sent with an identical key, the current request will be aborted. So if you're doing requests related to a users input (typing in an input field) and sending a request per input, this would stop all the old requests and only deliver the last request made as to stop race conditions.
This is the URL you wish to fetch, without parameters
This can be empty, an object that will be parsed to a querystring, or just a string.
This delays a request with the specified amount of miliseconds.
If this is enabled then any request will be cached in either local or session storage. Session storage is default. You can either send in a boolean, or you can send in an object like this
{ permanent: true, cachekey: 'myCacheKey' }
If permanent is set to true it will be stored in local storage.
The JSON options will add the header "Content-Type": application/json and it is enabled by default. If another content type header has been specified it will not override it.
Set this to false if you need to fetch any mimetype that is not json.
Fetch options is standard fetch opions. Read more about fetch options on MDN.
Clone this repo
Run
npm install
To run the interactive demo, run
npm run demo
In the Version 1 release the response is no longer automatically parsed to JSON. Consumers of the package will get the regular response object back just as if they had used the native fetch function.
FAQs
A script that improves a javascript fetch requests with request throttling, managing querystring parameters and delayed request start
We found that @wezz/fetchmanager demonstrated a healthy version release cadence and project activity because the last version was released less than 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
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.