Spaces:
Runtime error
Runtime error
Download node_modules/readable-stream/lib/internal/streams/BufferList.js from TrinetraLabs/PlaceboAI: direct link, hf CLI and curl.
- Browser
- Download file 2.01 kB
-
https://huggingface.co/spaces/TrinetraLabs/PlaceboAI/resolve/main/node_modules/readable-stream/lib/internal/streams/BufferList.js
- Command line
-
hf download hf://spaces/TrinetraLabs/PlaceboAI/node_modules/readable-stream/lib/internal/streams/BufferList.js
-
curl -L -o BufferList.js https://huggingface.co/spaces/TrinetraLabs/PlaceboAI/resolve/main/node_modules/readable-stream/lib/internal/streams/BufferList.js
2.01 kB
| ; | |
| function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | |
| var Buffer = require('safe-buffer').Buffer; | |
| var util = require('util'); | |
| function copyBuffer(src, target, offset) { | |
| src.copy(target, offset); | |
| } | |
| module.exports = function () { | |
| function BufferList() { | |
| _classCallCheck(this, BufferList); | |
| this.head = null; | |
| this.tail = null; | |
| this.length = 0; | |
| } | |
| BufferList.prototype.push = function push(v) { | |
| var entry = { data: v, next: null }; | |
| if (this.length > 0) this.tail.next = entry;else this.head = entry; | |
| this.tail = entry; | |
| ++this.length; | |
| }; | |
| BufferList.prototype.unshift = function unshift(v) { | |
| var entry = { data: v, next: this.head }; | |
| if (this.length === 0) this.tail = entry; | |
| this.head = entry; | |
| ++this.length; | |
| }; | |
| BufferList.prototype.shift = function shift() { | |
| if (this.length === 0) return; | |
| var ret = this.head.data; | |
| if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next; | |
| --this.length; | |
| return ret; | |
| }; | |
| BufferList.prototype.clear = function clear() { | |
| this.head = this.tail = null; | |
| this.length = 0; | |
| }; | |
| BufferList.prototype.join = function join(s) { | |
| if (this.length === 0) return ''; | |
| var p = this.head; | |
| var ret = '' + p.data; | |
| while (p = p.next) { | |
| ret += s + p.data; | |
| }return ret; | |
| }; | |
| BufferList.prototype.concat = function concat(n) { | |
| if (this.length === 0) return Buffer.alloc(0); | |
| var ret = Buffer.allocUnsafe(n >>> 0); | |
| var p = this.head; | |
| var i = 0; | |
| while (p) { | |
| copyBuffer(p.data, ret, i); | |
| i += p.data.length; | |
| p = p.next; | |
| } | |
| return ret; | |
| }; | |
| return BufferList; | |
| }(); | |
| if (util && util.inspect && util.inspect.custom) { | |
| module.exports.prototype[util.inspect.custom] = function () { | |
| var obj = util.inspect({ length: this.length }); | |
| return this.constructor.name + ' ' + obj; | |
| }; | |
| } |