{"library":"node-fetch","title":"Node-Fetch","description":"Node-Fetch brings the Web Fetch API to Node.js, providing a familiar interface for making HTTP requests in a Node.js environment. The current stable version is 3.3.2. Both the v3 (ESM-only) and v2 (CommonJS) branches are actively maintained, receiving regular bug fixes and occasional new features.","language":"javascript","status":"active","last_verified":"Sat Apr 18","install":{"commands":["npm install node-fetch"],"cli":null},"imports":["import fetch from 'node-fetch';","import { Headers } from 'node-fetch';","import { Request } from 'node-fetch';","import { Response } from 'node-fetch';","import { AbortController } from 'node-fetch';","import { AbortError } from 'node-fetch';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import fetch from 'node-fetch';\n\nasync function getTodoItem() {\n  try {\n    const response = await fetch('https://jsonplaceholder.typicode.com/todos/1');\n\n    if (!response.ok) {\n      throw new Error(`HTTP error! status: ${response.status}`);\n    }\n\n    const data = await response.json();\n    console.log('Fetched TODO item:', data);\n  } catch (error) {\n    console.error('Error fetching data:', error);\n  }\n}\n\ngetTodoItem();","lang":"typescript","description":"This example demonstrates how to make a basic GET request to an external API and parse the JSON response. It also includes error handling for network issues and non-OK HTTP statuses.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}