A Node.js module bundling common helpers for hashing, encoding, dates, numbers, strings, JSON files, maps, and timed promises.
Overview
utility is a Node.js dependency bundling compact helpers for routine server and application tooling. Add it to a project and invoke its APIs from JavaScript or TypeScript.
Hashing and message-authentication utilities cover md5, sha1, sha256, and hmac. Encoding and decoding helpers appear next to broader miscellaneous utilities. Date and number helpers handle familiar formatting and transformation tasks. String utilities and a Try wrapper rely on particular call patterns.
Structured-data helpers read and write JSON, including asynchronous access and writeJSON settings for replacer and spacing comparable to JSON.stringify. A map helper constructs objects with no prototype chain using Object.create(null). runWithTimeout executes a promise under a time limit and rejects with TimeoutError when the limit is exceeded. argumentsToArray converts argument lists for use by other helpers.
The module ships on npm as utility and is kept as an open-source package with tests and benchmarks on selected date-formatting code paths. getIP() was dropped in favor of a separate dedicated module.
Key features
- MD5, SHA1, SHA256, and HMAC
- Encode and decode helpers
- Date and number utilities
- String helpers and Try wrapper
- JSON read, write, and async APIs
- Prototype-free map helper
- Promise runWithTimeout
Use cases
- Shared helpers across Node.js services
- Hashing and encoding in scripts
- JSON file utilities in tooling
- Timeout-wrapped async operations