Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
fast-querystring
Advanced tools
Fast query-string parser and stringifier to replace the legacy node:querystring
module.
npm i fast-querystring
parse
and stringify
methods from node:querystring
module&
separator as defaultstring
foo=bar&foo=baz
parses into {foo: ['bar', 'baz']}
foo=bar&hola
parses into {foo: 'bar', hola: ''}
node:querystring
)const qs = require('fast-querystring')
// Parsing a querystring
console.log(qs.parse('hello=world&foo=bar&values=v1&values=v2'))
// {
// hello: 'world',
// foo: 'bar',
// values: ['v1', 'v2']
// }
// Stringifying an object
console.log(qs.stringify({ foo: ['bar', 'baz'] }))
// 'foo=bar&foo=baz'
All benchmarks are run using Node.js v20.2.0 running on M1 Max.
> node benchmark/parse.mjs
╔═════════════════════════════════════════╤═════════╤═══════════════════╤═══════════╗
║ Slower tests │ Samples │ Result │ Tolerance ║
╟─────────────────────────────────────────┼─────────┼───────────────────┼───────────╢
║ query-string │ 10000 │ 273968.62 op/sec │ ± 1.48 % ║
║ qs │ 9999 │ 324118.68 op/sec │ ± 0.99 % ║
║ querystringify │ 1000 │ 410157.64 op/sec │ ± 0.68 % ║
║ @aws-sdk/querystring-parser │ 1000 │ 431465.20 op/sec │ ± 0.83 % ║
║ URLSearchParams-with-Object.fromEntries │ 5000 │ 833939.19 op/sec │ ± 0.97 % ║
║ URLSearchParams-with-construct │ 10000 │ 980017.92 op/sec │ ± 2.42 % ║
║ node:querystring │ 10000 │ 1068165.86 op/sec │ ± 3.41 % ║
║ querystringparser │ 3000 │ 1384001.31 op/sec │ ± 0.95 % ║
╟─────────────────────────────────────────┼─────────┼───────────────────┼───────────╢
║ Fastest test │ Samples │ Result │ Tolerance ║
╟─────────────────────────────────────────┼─────────┼───────────────────┼───────────╢
║ fast-querystring │ 10000 │ 1584458.62 op/sec │ ± 2.64 % ║
╚═════════════════════════════════════════╧═════════╧═══════════════════╧═══════════╝
> node benchmark/stringify.mjs
╔══════════════════════════════╤═════════╤═══════════════════╤═══════════╗
║ Slower tests │ Samples │ Result │ Tolerance ║
╟──────────────────────────────┼─────────┼───────────────────┼───────────╢
║ query-string │ 10000 │ 314662.25 op/sec │ ± 1.08 % ║
║ qs │ 9500 │ 353621.74 op/sec │ ± 0.98 % ║
║ http-querystring-stringify │ 10000 │ 372189.04 op/sec │ ± 1.48 % ║
║ @aws-sdk/querystring-builder │ 10000 │ 411658.63 op/sec │ ± 1.67 % ║
║ URLSearchParams │ 10000 │ 454438.85 op/sec │ ± 1.32 % ║
║ querystringparser │ 10000 │ 455615.18 op/sec │ ± 4.22 % ║
║ querystringify │ 10000 │ 879020.96 op/sec │ ± 2.12 % ║
║ querystringify-ts │ 10000 │ 879134.48 op/sec │ ± 2.19 % ║
║ node:querystring │ 10000 │ 1244505.97 op/sec │ ± 2.12 % ║
╟──────────────────────────────┼─────────┼───────────────────┼───────────╢
║ Fastest test │ Samples │ Result │ Tolerance ║
╟──────────────────────────────┼─────────┼───────────────────┼───────────╢
║ fast-querystring │ 10000 │ 1953717.60 op/sec │ ± 3.16 % ║
╚══════════════════════════════╧═════════╧═══════════════════╧═══════════╝
> node benchmark/import.mjs
╔═════════════════════════════╤═════════╤═════════════════╤═══════════╗
║ Slower tests │ Samples │ Result │ Tolerance ║
╟─────────────────────────────┼─────────┼─────────────────┼───────────╢
║ @aws-sdk/querystring-parser │ 1000 │ 12360.51 op/sec │ ± 0.57 % ║
║ qs │ 1000 │ 14507.74 op/sec │ ± 0.36 % ║
║ querystringify │ 1000 │ 14750.53 op/sec │ ± 0.39 % ║
║ query-string │ 1000 │ 16335.05 op/sec │ ± 0.87 % ║
║ querystringparser │ 1000 │ 17018.50 op/sec │ ± 0.42 % ║
╟─────────────────────────────┼─────────┼─────────────────┼───────────╢
║ Fastest test │ Samples │ Result │ Tolerance ║
╟─────────────────────────────┼─────────┼─────────────────┼───────────╢
║ fast-querystring │ 2500 │ 74605.83 op/sec │ ± 0.91 % ║
╚═════════════════════════════╧═════════╧═════════════════╧═══════════╝
FAQs
A fast alternative to legacy querystring module
We found that fast-querystring demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.