mirror of
https://codeberg.org/Kankys/NewLukasBlog.git
synced 2026-11-11 06:14:36 +01:00
OpravyPoAI
This commit is contained in:
1 parent
99aa797101
commit
24fd53c94c
4746 files changed
+700320
-12
No files matched your search
+32
@@ -0,0 +1,32 @@
|
||||
import {getStreamContents} from './contents.js';
|
||||
import {identity, noop, getContentsProp} from './utils.js';
|
||||
|
||||
export async function getStreamAsArray(stream, options) {
|
||||
return getStreamContents(stream, arrayMethods, options);
|
||||
}
|
||||
|
||||
const initArray = () => ({contents: []});
|
||||
|
||||
const increment = () => 1;
|
||||
|
||||
const addArrayChunk = (convertedChunk, {contents}) => {
|
||||
contents.push(convertedChunk);
|
||||
return contents;
|
||||
};
|
||||
|
||||
const arrayMethods = {
|
||||
init: initArray,
|
||||
convertChunk: {
|
||||
string: identity,
|
||||
buffer: identity,
|
||||
arrayBuffer: identity,
|
||||
dataView: identity,
|
||||
typedArray: identity,
|
||||
others: identity,
|
||||
},
|
||||
getSize: increment,
|
||||
truncateChunk: noop,
|
||||
addChunk: addArrayChunk,
|
||||
getFinalChunk: noop,
|
||||
finalize: getContentsProp,
|
||||
};
|
||||
Reference in new issue
Block a user