Docs: improve output format info for toBuffer

This commit is contained in:
Lovell Fuller
2022-04-25 11:41:06 +01:00
parent ee948ac6fa
commit 58c2af3251
3 changed files with 89 additions and 77 deletions

View File

@@ -82,6 +82,8 @@ function toFile (fileOut, callback) {
* Write output to a Buffer.
* JPEG, PNG, WebP, AVIF, TIFF, GIF and raw pixel data output are supported.
*
* Use {@link toFormat} or one of the format-specific functions such as {@link jpeg}, {@link png} etc. to set the output format.
*
* If no explicit format is set, the output format will match the input image, except SVG input which becomes PNG output.
*
* By default all metadata will be removed, which includes EXIF-based orientation.
@@ -108,6 +110,7 @@ function toFile (fileOut, callback) {
*
* @example
* sharp(input)
* .png()
* .toBuffer({ resolveWithObject: true })
* .then(({ data, info }) => { ... })
* .catch(err => { ... });