MCPcopy Create free account
hub / github.com/StephanGeorg/staticmaps / buffer

Method buffer

src/image.js:124–134  ·  view source on GitHub ↗

* Return image as buffer

(mime = 'image/png', outOpts = {})

Source from the content-addressed store, hash-verified

122 * Return image as buffer
123 */
124 async buffer(mime = 'image/png', outOpts = {}) {
125 const outputOptions = outOpts;
126 outputOptions.quality = outputOptions.quality || this.quality;
127 switch (mime.toLowerCase()) {
128 case 'image/webp': return sharp(this.image).webp(outputOptions).toBuffer();
129 case 'image/jpeg':
130 case 'image/jpg': return sharp(this.image).jpeg(outputOptions).toBuffer();
131 case 'image/png':
132 default: return sharp(this.image).png(outputOptions).toBuffer();
133 }
134 }
135}
136
137module.exports = Image;

Callers 1

staticmaps.jsFile · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected