本文整理匯總了TypeScript中stream-buffers.ReadableStreamBuffer.on方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript ReadableStreamBuffer.on方法的具體用法?TypeScript ReadableStreamBuffer.on怎麽用?TypeScript ReadableStreamBuffer.on使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類stream-buffers.ReadableStreamBuffer
的用法示例。
在下文中一共展示了ReadableStreamBuffer.on方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: function
myWritableStreamBuffer.size();
myWritableStreamBuffer.maxSize();
// Gets all held data as a Buffer.
myWritableStreamBuffer.getContents();
// Gets all held data as a utf8 string.
myWritableStreamBuffer.getContentsAsString('utf8');
// Gets first 5 bytes as a Buffer.
myWritableStreamBuffer.getContents(5);
// Gets first 5 bytes as a utf8 string.
myWritableStreamBuffer.getContentsAsString('utf8', 5);
var myReadableStreamBuffer = new streamBuffers.ReadableStreamBuffer({
frequency: 10, // in milliseconds.
chunkSize: 2048 // in bytes.
});
myReadableStreamBuffer.put('A String', 'utf8');
myReadableStreamBuffer.put(buffer);
myReadableStreamBuffer.on('data', function(data) {
// streams1.x style data
// assert.isTrue(data instanceof Buffer);
});
myReadableStreamBuffer.put('the last data this stream will ever see');
myReadableStreamBuffer.stop();