{"library":"react-native-fetch-api","title":"React Native Fetch API","description":"A fetch API polyfill for React Native built on top of the native Networking API instead of XMLHttpRequest, enabling text streaming support. Current stable version is 3.0.0 (2022-12-01). This package is maintained by the React Native community and released on an as-needed basis. Key differentiators: supports streaming text via ReadableStream (Response.body) for performance, avoids XHR overhead. Limited to text-only streaming; binary transfers do not support incremental reading. For apps requiring text streaming in React Native.","language":"javascript","status":"active","last_verified":"Sat Apr 25","install":{"commands":["npm install react-native-fetch-api"],"cli":null},"imports":["import fetch from 'react-native-fetch-api'","import { Headers } from 'react-native-fetch-api'","import { Request } from 'react-native-fetch-api'"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import fetch, { Headers, Request, Response } from 'react-native-fetch-api';\n\nasync function streamText() {\n  const response = await fetch('https://example.com/data', {\n    method: 'GET',\n    headers: new Headers({ 'Accept': 'text/plain' })\n  });\n  const reader = response.body.getReader();\n  const decoder = new TextDecoder();\n  let result = '';\n  while (true) {\n    const { done, value } = await reader.read();\n    if (done) break;\n    result += decoder.decode(value, { stream: true });\n  }\n  console.log(result);\n}\nstreamText().catch(console.error);","lang":"typescript","description":"Demonstrates using the fetch API with text streaming: importing default fetch and named constructors, making a GET request, and reading the response body as a stream.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}