Ghost/ghost/image-transform
Daniel Lockyer eef85bba90 Disabled Sharp's internal cache to improve memory usage
refs https://sharp.pixelplumbing.com/api-utility#cache

- Sharp has a 50MB cache by default, used within libvips, to increase
  the performance of transforming images
- this isn't relevant to us because we should never be optimizing the
  same image as we check if the optimized image already exists
- I presume there is also some extra overhead of using the cache because
  the memory doesn't seem to grow by 50MB
- the memory usage comparison in Ghost is pretty drastic - uploading 10
  images in serial w/ jemalloc:
  - with cache (default) = peak of 480MB, settles down to 330MB
  - disabling cache = peak of 270MB, settles down to 161MB
- this commit disables the cache
- also adds stubbing for the function in tests
2021-11-05 11:59:39 +00:00
..
lib Disabled Sharp's internal cache to improve memory usage 2021-11-05 11:59:39 +00:00
test Disabled Sharp's internal cache to improve memory usage 2021-11-05 11:59:39 +00:00
.eslintrc.js Remove trailing commas from .eslintrc.js files 2020-08-04 14:48:07 +01:00
index.js Updated paths & tests to work in new pkg structure 2020-03-25 14:48:41 +00:00
LICENSE 2021 2021-01-25 16:20:43 +00:00
package.json Published new versions 2021-10-22 16:01:20 +04:00
README.md 2021 2021-01-25 16:20:43 +00:00

Image Transform

Install

npm install @tryghost/image-transform --save

or

yarn add @tryghost/image-transform

Usage

Develop

This is a mono repository, managed with lerna.

Follow the instructions for the top-level repo.

  1. git clone this repo & cd into it as usual
  2. Run yarn to install top-level dependencies.

Run

  • yarn dev

Test

  • yarn lint run just eslint
  • yarn test run lint and tests

Copyright & License

Copyright (c) 2013-2021 Ghost Foundation - Released under the MIT license.