Spaces:
Runtime error
Runtime error
Download masteringModule/node_modules/superagent/lib/node/parsers/json.js from SE-09/HapticsProject: direct link, hf CLI and curl.
- Browser
- Download file 560 Bytes
-
https://huggingface.co/spaces/SE-09/HapticsProject/resolve/refs%2Fpr%2F32/masteringModule/node_modules/superagent/lib/node/parsers/json.js
- Command line
-
hf download hf://spaces/SE-09/HapticsProject@refs/pr/32/masteringModule/node_modules/superagent/lib/node/parsers/json.js
-
curl -L -o json.js https://huggingface.co/spaces/SE-09/HapticsProject/resolve/refs%2Fpr%2F32/masteringModule/node_modules/superagent/lib/node/parsers/json.js
560 Bytes
| module.exports = function parseJSON(res, fn){ | |
| res.text = ''; | |
| res.setEncoding('utf8'); | |
| res.on('data', function(chunk){ res.text += chunk;}); | |
| res.on('end', function(){ | |
| try { | |
| var body = res.text && JSON.parse(res.text); | |
| } catch (e) { | |
| var err = e; | |
| // issue #675: return the raw response if the response parsing fails | |
| err.rawResponse = res.text || null; | |
| // issue #876: return the http status code if the response parsing fails | |
| err.statusCode = res.statusCode; | |
| } finally { | |
| fn(err, body); | |
| } | |
| }); | |
| }; | |