Package managers
Meros is available on npm and can be installed using your preferred package manager:Requirements
Node.js version: Meros requires Node.js version 13 or higher when used in Node.js environments.
- Zero dependencies - No additional packages required
- Universal support - Works in both browser and Node.js
- TypeScript types - Included out of the box
- Tiny size - Only 642 bytes gzipped
TypeScript support
Meros is written in TypeScript and includes type definitions automatically. If you’re using Node.js, you’ll want to install the Node.js type definitions:The
@types/node package is marked as an optional peer dependency, so you only need it if you’re using Meros in a Node.js environment.Import paths
Meros provides multiple import paths depending on your environment:Automatic environment detection
The default import automatically detects your environment (browser or Node.js) based on your bundler configuration:Browser-specific import
Explicitly import the browser version:- Works with
Responseobjects from the Fetch API - Returns parts with
bodyasstringtype - Processes
ReadableStream<Uint8Array>from response bodies
Node.js-specific import
Explicitly import the Node.js version:- Works with
IncomingMessagefrom thehttpmodule - Returns parts with
bodyasBuffertype - Processes Node.js
Readablestreams
CDN usage
You can also use Meros directly from a CDN without any build step:Module formats
Meros is distributed in multiple formats to support different module systems:- ESM (ES Modules):
.mjsfiles for modern JavaScript - CommonJS:
.jsfiles for Node.js and older bundlers - TypeScript:
.d.tstype definitions included
Package exports
The package.json exports field ensures your bundler gets the right version:Verification
After installation, verify that Meros is working correctly:Next steps
Get started with the quickstart guide
Learn how to use Meros to read your first multipart response