@@ -5,7 +5,6 @@ module.exports.pathBasename = pathBasename
55module . exports . getFullUri = getFullUri
66module . exports . hasSuffix = hasSuffix
77module . exports . parse = parse
8- module . exports . processHandlebarFile = processHandlebarFile
98module . exports . serialize = serialize
109module . exports . translate = translate
1110module . exports . stringToStream = stringToStream
@@ -14,8 +13,10 @@ module.exports.debrack = debrack
1413module . exports . stripLineEndings = stripLineEndings
1514module . exports . fullUrlForReq = fullUrlForReq
1615module . exports . routeResolvedFile = routeResolvedFile
16+ module . exports . processHandlebarFile = processHandlebarFile
17+ module . exports . copyTemplateDir = copyTemplateDir
1718
18- const fs = require ( 'fs' )
19+ const fs = require ( 'fs-extra ' )
1920const path = require ( 'path' )
2021const $rdf = require ( 'rdflib' )
2122const from = require ( 'from2' )
@@ -198,9 +199,19 @@ function processHandlebarTemplate (source, substitutions) {
198199 }
199200}
200201
202+ async function copyTemplateDir ( templatePath , targetPath ) {
203+ return new Promise ( ( resolve , reject ) => {
204+ fs . copy ( templatePath , targetPath , ( error ) => {
205+ if ( error ) { return reject ( error ) }
206+
207+ resolve ( )
208+ } )
209+ } )
210+ }
211+
201212function serialize ( graph , baseUri , contentType , callback ) {
202213 try {
203- // target, kb, base, contentType, callback
214+ // target, kb, base, contentType, callback
204215 $rdf . serialize ( null , graph , baseUri , contentType , function ( err , result ) {
205216 if ( err ) {
206217 console . log ( err )
@@ -222,9 +233,9 @@ function serialize (graph, baseUri, contentType, callback) {
222233function translate ( stream , baseUri , from , to , callback ) {
223234 // Handle Turtle Accept header
224235 if ( to === 'text/turtle' ||
225- to === 'text/n3' ||
226- to === 'application/turtle' ||
227- to === 'application/n3' ) {
236+ to === 'text/n3' ||
237+ to === 'application/turtle' ||
238+ to === 'application/n3' ) {
228239 to = 'text/turtle'
229240 }
230241
0 commit comments