Spaces:
Runtime error
Runtime error
Download masteringModule/node_modules/formidable/lib/json_parser.js from SE-09/HapticsProject: direct link, hf CLI and curl.
- Browser
- Download file 650 Bytes
-
https://huggingface.co/spaces/SE-09/HapticsProject/resolve/refs%2Fpr%2F32/masteringModule/node_modules/formidable/lib/json_parser.js
- Command line
-
hf download hf://spaces/SE-09/HapticsProject@refs/pr/32/masteringModule/node_modules/formidable/lib/json_parser.js
-
curl -L -o json_parser.js https://huggingface.co/spaces/SE-09/HapticsProject/resolve/refs%2Fpr%2F32/masteringModule/node_modules/formidable/lib/json_parser.js
650 Bytes
| if (global.GENTLY) require = GENTLY.hijack(require); | |
| var Buffer = require('buffer').Buffer; | |
| function JSONParser(parent) { | |
| this.parent = parent; | |
| this.chunks = []; | |
| this.bytesWritten = 0; | |
| } | |
| exports.JSONParser = JSONParser; | |
| JSONParser.prototype.write = function(buffer) { | |
| this.bytesWritten += buffer.length; | |
| this.chunks.push(buffer); | |
| return buffer.length; | |
| }; | |
| JSONParser.prototype.end = function() { | |
| try { | |
| var fields = JSON.parse(Buffer.concat(this.chunks)); | |
| for (var field in fields) { | |
| this.onField(field, fields[field]); | |
| } | |
| } catch (e) { | |
| this.parent.emit('error', e); | |
| } | |
| this.data = null; | |
| this.onEnd(); | |
| }; | |