MCPcopy
hub / github.com/jimp-dev/jimp / write

Method write

packages/core/src/index.ts:503–513  ·  view source on GitHub ↗

* Write the image to a file * @param path the path to write the image to * @param options the options to use when writing the image * @example * ```ts * import { Jimp } from "jimp"; * * const image = Jimp.fromBuffer(Buffer.from([ * 0xff, 0x00, 0x00, 0x00, 0x

(path: PathWithExtension<Extension>, options?: Options)

Source from the content-addressed store, hash-verified

501 * ```
502 */
503 async write<
504 Extension extends string,
505 Mime extends GetMimeTypeForExtension<Extension, ExtensionToMimeType>,
506 Options extends GetOptionsForMimeType<Mime, MimeTypeToExportOptions>,
507 >(path: PathWithExtension<Extension>, options?: Options) {
508 const mimeType = mime.getType(path);
509 await writeFile(
510 path,
511 await this.getBuffer(mimeType as SupportedMimeTypes, options)
512 );
513 }
514
515 /**
516 * Clone the image into a new Jimp instance.

Callers 1

pngFunction · 0.80

Calls 1

getBufferMethod · 0.95

Tested by

no test coverage detected