MCPcopy Index your code
hub / github.com/nodeSolidServer/node-solid-server / stringToStream

Function stringToStream

lib/utils.mjs:194–210  ·  view source on GitHub ↗
(string)

Source from the content-addressed store, hash-verified

192 * @return {ReadableStream}
193 */
194export function stringToStream (string) {
195 return from(function (size, next) {
196 // if there's no more content
197 // left in the string, close the stream.
198 if (!string || string.length <= 0) {
199 return next(null, null)
200 }
201
202 // Pull in a new chunk of text,
203 // removing it from the string.
204 const chunk = string.slice(0, size)
205 string = string.slice(size)
206
207 // Emit "chunk" from the stream.
208 next(null, chunk)
209 })
210}
211
212/**
213 * Removes line ending characters (\n and \r) from a string.

Callers 4

putGraphMethod · 0.90
getMethod · 0.90
putValidRdfFunction · 0.90
ldp-test.mjsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected