[{"data":1,"prerenderedAt":86},["Reactive",2],{"/samples/node/got":3,"related:jZPfDLAQYb":60},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"language":10,"library":8,"link":11,"body":12,"_type":55,"_id":56,"_source":57,"_file":58,"_extension":59},"/samples/node/got","node",false,"","Got","Got is a lightweight and flexible HTTP client for Node.js. It provides a simple API for making HTTP requests with support for Promises and async/await syntax. Got focuses on performance, ease of use, and extensibility.","Node","https://www.npmjs.com/package/got",{"type":13,"children":14,"toc":52},"root",[15,30,43],{"type":16,"tag":17,"props":18,"children":19},"element","p",{},[20,28],{"type":16,"tag":21,"props":22,"children":25},"a",{"href":11,"rel":23},[24],"nofollow",[26],{"type":27,"value":8},"text",{"type":27,"value":29}," is a lightweight and flexible HTTP client for Node.js. It provides a simple API for making HTTP requests with support for Promises and async/await syntax. Got focuses on performance, ease of use, and extensibility.",{"type":16,"tag":31,"props":32,"children":37},"pre",{"className":33,"code":35,"language":36,"meta":7},[34],"language-javascript","const got = require('got');\n\nasync function convert(apiKey, params, endpoint='pdf') {\n\n    if (!['pdf', 'png', 'jpg', 'webp'].includes(endpoint)){\n        throw new Error('Invalid endpoint');\n    }\n\n    const response = await got.post(`https://api.pdfshift.io/v3/convert/${endpoint}`, {\n        headers: { 'X-API-Key': apiKey },\n        json: params,\n        responseType: 'json'\n    });\n\n    if ('filename' in params || 'webhook' in params){\n        return response.body;\n    }\n\n    return response.rawBody;\n}\n","javascript",[38],{"type":16,"tag":39,"props":40,"children":41},"code",{"__ignoreMap":7},[42],{"type":27,"value":35},{"type":16,"tag":31,"props":44,"children":47},{"className":45,"code":46,"language":36,"meta":7},[34],"(async () => {\n    const binary = await convert('sk_XXXXXXXXXXXXXX', { source: 'https://en.wikipedia.org/wiki/REST' });\n\n    require('fs').writeFileSync('result.pdf', binary);\n})()\n",[48],{"type":16,"tag":39,"props":49,"children":50},{"__ignoreMap":7},[51],{"type":27,"value":46},{"title":7,"searchDepth":53,"depth":53,"links":54},2,[],"markdown","content:samples:node:got.md","content","samples/node/got.md","md",[61,65,69,70,74,78,82],{"_path":62,"language":10,"library":63,"_id":64},"/samples/node/axios","Axios","content:samples:node:axios.md",{"_path":66,"language":10,"library":67,"_id":68},"/samples/node/bent","Bent","content:samples:node:bent.md",{"_path":4,"language":10,"library":8,"_id":56},{"_path":71,"language":10,"library":72,"_id":73},"/samples/node/needle","Needle","content:samples:node:needle.md",{"_path":75,"language":10,"library":76,"_id":77},"/samples/node/node-fetch","Node Fetch","content:samples:node:node-fetch.md",{"_path":79,"language":10,"library":80,"_id":81},"/samples/node/superagent","SuperAgent","content:samples:node:superagent.md",{"_path":83,"language":10,"library":84,"_id":85},"/samples/node/unfetch","Unfetch","content:samples:node:unfetch.md",1785426823231]