Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Cork is a minimal layer that sits on top of the request module and adds a few patterns that make working with 3rd party APIs simpler.
npm install cork
var cork = require('cork');
// First, let's register a new service with the name "buzz" and a few defaults
cork.register('buzz', {
'method': 'get',
'headers': {
'x-api-key': 'someApiKeyGoesHere'
},
'json': {}
'timeout': 20000
});
// Next, let's make a request based on that service
cork.request('buzz', {
'uri': 'https://api.geek.com/some/resource'
}, function (err, body) {
console.dir(body); // Woo!
});
// Neato! But let's say we want to create another request and override some of the defaults
cork.request('buzz', {
'method': 'post'
'uri': 'https://api.geek.com/some/other/resource',
'json': {
'foo': 'bar'
}
}, function (err, body) {
console.dir(body); // Huzzah!
});
A base URI can be defined during registration by passing the optional base
parameter:
cork.register('dork', {
base: 'http://api.nerd.com',
});
cork.request('dork', {
uri: '/yet/another/resource'
}, function (err, body) {
// Weee!
});
When registering a service, Cork accepts an optional throttle
parameter which represents a request limit expressed in milliseconds. Any requests that subsequently hit the throttle limit will be queued and processed in FIFO order. For example, let's say that we are working with an API that only accepts 10 requests per second:
cork.register('geek', {
throttle: 100 // 1 request per 100 milliseconds
});
npm test
FAQs
An API utility belt for request.
The npm package cork receives a total of 0 weekly downloads. As such, cork popularity was classified as not popular.
We found that cork demonstrated a not healthy version release cadence and project activity because the last version was released 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 researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.