Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /var/www/html/node-red/node_modules/stream-buffers/lib/ drwxr-xr-x | |
| Viewing file: Select action/file-type: 'use strict';
var util = require('util');
var stream = require('stream');
var constants = require('./constants');
var WritableStreamBuffer = module.exports = function(opts) {
opts = opts || {};
opts.decodeStrings = true;
stream.Writable.call(this, opts);
var initialSize = opts.initialSize || constants.DEFAULT_INITIAL_SIZE;
var incrementAmount = opts.incrementAmount || constants.DEFAULT_INCREMENT_AMOUNT;
var buffer = new Buffer(initialSize);
var size = 0;
this.size = function() {
return size;
};
this.maxSize = function() {
return buffer.length;
};
this.getContents = function(length) {
if(!size) return false;
var data = new Buffer(Math.min(length || size, size));
buffer.copy(data, 0, 0, data.length);
if(data.length < size)
buffer.copy(buffer, 0, data.length);
size -= data.length;
return data;
};
this.getContentsAsString = function(encoding, length) {
if(!size) return false;
var data = buffer.toString(encoding || 'utf8', 0, Math.min(length || size, size));
var dataLength = Buffer.byteLength(data);
if(dataLength < size)
buffer.copy(buffer, 0, dataLength);
size -= dataLength;
return data;
};
var increaseBufferIfNecessary = function(incomingDataSize) {
if((buffer.length - size) < incomingDataSize) {
var factor = Math.ceil((incomingDataSize - (buffer.length - size)) / incrementAmount);
var newBuffer = new Buffer(buffer.length + (incrementAmount * factor));
buffer.copy(newBuffer, 0, 0, size);
buffer = newBuffer;
}
};
this._write = function(chunk, encoding, callback) {
increaseBufferIfNecessary(chunk.length);
chunk.copy(buffer, size, 0);
size += chunk.length;
callback();
};
};
util.inherits(WritableStreamBuffer, stream.Writable);
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0163 ]-- |