Download node_modules/get-stream/source/array.js from Snapkitty/sovereign-apollo: direct link, hf CLI and curl.
- Browser
- Download file 757 Bytes
-
https://huggingface.co/Snapkitty/sovereign-apollo/resolve/main/node_modules/get-stream/source/array.js
- Command line
-
hf download hf://Snapkitty/sovereign-apollo/node_modules/get-stream/source/array.js
-
curl -L -o array.js https://huggingface.co/Snapkitty/sovereign-apollo/resolve/main/node_modules/get-stream/source/array.js
757 Bytes
| 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, | |
| }; | |