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

Function translate

lib/utils.mjs:168–183  ·  view source on GitHub ↗
(stream, baseUri, from, to)

Source from the content-addressed store, hash-verified

166 * @return {string}
167 */
168export function translate (stream, baseUri, from, to) {
169 return new Promise((resolve, reject) => {
170 let data = ''
171 stream
172 .on('data', function (chunk) {
173 data += chunk
174 })
175 .on('end', function () {
176 const graph = $rdf.graph()
177 $rdf.parse(data, graph, baseUri, from, function (err) {
178 if (err) return reject(err)
179 resolve(serialize(graph, baseUri, to))
180 })
181 })
182 })
183}
184
185/**
186 * Converts a given string to a Node.js Readable Stream.

Callers 1

handlerFunction · 0.90

Calls 2

serializeFunction · 0.85
graphMethod · 0.80

Tested by

no test coverage detected