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

Function serialize

lib/utils.mjs:138–157  ·  view source on GitHub ↗
(graph, base, contentType)

Source from the content-addressed store, hash-verified

136 * @return {string}
137 */
138export function serialize (graph, base, contentType) {
139 return new Promise((resolve, reject) => {
140 try {
141 // target, kb, base, contentType, callback
142 $rdf.serialize(null, graph, base, contentType, function (err, result) {
143 if (err) {
144 return reject(err)
145 }
146 if (result === undefined) {
147 return reject(new Error('Error serializing the graph to ' +
148 contentType))
149 }
150
151 resolve(result)
152 })
153 } catch (err) {
154 reject(err)
155 }
156 })
157}
158
159/**
160 * Translates common RDF content types to `rdflib` parser names.

Callers 4

listContainerMethod · 0.90
putGraphMethod · 0.90
applyPatchMethod · 0.90
translateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected