npm.io
0.4.0 • Published 1 month ago

lilyware

Licence
MIT
Version
0.4.0
Deps
1
Size
11 kB
Vulns
0
Weekly
0
Stars
6

LilyWare

LilyWare is an express middleware for serving lilypond files. Written in TypeScript; ships with type declarations.

Usage

app.use(lilyware(basePath))

Looks in basePath for requested .ly files and serves them rendered according to the URL query string (e.g. test.ly?format=png&resolution=30).

Requests that do not end in .ly are passed through with next().

Options

app.use(lilyware(basePath, {
  cache: true,      // default: in-memory cache keyed by file mtime
  renderer: ...,    // optional override for the lilynode.renderFile callable
                    // (mainly useful for testing)
}))

Query options

Possible options to configure rendering via URL query parameters.

format

Possible values: png, svg, pdf, ps, midi Default: png

Unsupported values return 400 Bad Request.

resolution

Resolution in ppcm (only meaningful for the png format). Default: 50

Responses

Status When
200 Rendered output, with the matching Content-Type
400 format query param is not supported
403 Path attempts to escape basePath
404 .ly file does not exist
500 Renderer error (forwarded via next(error))