Utility for fetching media resources with automatic encoding/decoding. v3.3.4, TypeScript-first, actively maintained. Automatically handles JSON, text, binary, FormData, and URL-encoded request/response bodies. Parses structured errors. Known incompatibility with Node 18+ native fetch due to Response class differences. Requires manual installation of @ungap/url-search-params for React Native. Differentiator: intelligent media type handling versus raw fetch or other wrappers.
npm install fetch-mediaNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic usage of fetchMedia with automatic JSON encoding/decoding.
Use a polyfill like node-fetch or undici that provides a compatible Response class.
Run: yarn add @ungap/url-search-params
Ensure the global fetch is not overridden or test compatibility.
Install @ungap/url-search-params: npm install @ungap/url-search-params
Use: import { fetchMedia } from 'fetch-media'Provide a properly formatted URL string.