Download next.js/test/integration/api-support/pages/api/test-res-pipe.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 228 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/test/integration/api-support/pages/api/test-res-pipe.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/next.js/test/integration/api-support/pages/api/test-res-pipe.js
-
curl -L -o test-res-pipe.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/test/integration/api-support/pages/api/test-res-pipe.js
228 Bytes
| import fetch from 'node-fetch' | |
| export default async (req, res) => { | |
| const dataRes = await fetch( | |
| `http://localhost:${req.query.port}/api/query?hello=from-pipe` | |
| ) | |
| res.status(dataRes.status) | |
| dataRes.body.pipe(res) | |
| } | |