Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
header-timers
Advanced tools
header-timers
⏱️
Server-Timing HTTP header helper
Create timers and report to the browser with a Server-Timing
header.
header-timers
on npmjs.org »
Contents:
Install
•
Usage
•
Goals
•
Server-Timing
Reference
npm i header-timers
[!NOTE]
This is a Node.js library and won't work in a browser runtime.
Just .js samples for now:
import HeaderTimers from 'header-timers'
const timers = HeaderTimers()
const { start, stop } = timers
start('open')
stop('open')
start('database', 'collecting data') // with a description
start('analytics', 'log request data')
await new Promise(resolve => setTimeout(resolve, 100))
stop('analytics')
await new Promise(resolve => setTimeout(resolve, 500))
stop('database')
console.log('TIMER COUNT', timers.timers().length) // 3
console.log(timers.key)
// "Server-Timing" - just in case you need it!
console.log(timers.timers())
// [ Array of Timer Objects ]
console.log(timers.values())
/**
[
'open;dur=0.026ms',
'database;desc="collecting data";dur=603.098792ms',
'analytics;desc="log request data";dur=101.776917ms'
]
*/
console.log(timers.value())
// "open;dur=0.014ms, database;desc="collecting data";dur=603.512ms, analytics;desc="log request data";dur=101.475709ms"
console.log(timers.string())
// "Server-Timing: open;dur=0.014ms, database;desc="collecting data";dur=603.512ms, analytics;desc="log request data";dur=101.475709ms"
console.log(timers.object())
/**
{
'Server-Timing': 'open;dur=0.026ms, database;desc="collecting data";dur=603.098792ms, analytics;desc="log request data";dur=101.776917ms'
}
*/
Also...
// ...
start("this won't work")
timers.reset()
stop("this won't work")
console.log('TIMER COUNT', timers.timers().length) // 0
start('reset')
await new Promise(resolve => setTimeout(resolve, 100))
stop('reset')
console.log('TIMER COUNT', timers.timers().length) // 1
console.log('NEW Header String', timers.string())
// NEW Header String "Server-Timing: reset;dur=101.799166ms"
And...
// names optional; be aware of the order, though!
start() // 1
stop() // stop 1 => <1ms
start() // 2
start('foo')
start() // 3
stop() // stop 3 => <1ms
await new Promise(resolve => setTimeout(resolve, 100))
stop() // stop 2 => 100+ms
stop('foo') // => 100+ms
Be helpful and accurate. Stay small and fast. Then be intuitive. This means:
"It's just strings all the way down"
0.3.0
#toString()
is now #string()
#toObject()
is now #object()
The toString
method name was changed to string
to avoid confusion with the native toString
method. To keep the API consistent, the toObject
method was also changed to object
.
FAQs
Server-Timing HTTP header helper
The npm package header-timers receives a total of 53 weekly downloads. As such, header-timers popularity was classified as not popular.
We found that header-timers demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.