How to use the tinify.compressionCount function in tinify

To help you get started, we’ve selected a few tinify examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github CatchZeng / AppThinning / src / util / tinyPng / index.js View on Github external
tinify.validate(function(err) {
      if (err) {
        reject(new TinyPngValidateError())
      }

      const compressionsThisMonth = tinify.compressionCount
      if (compressionsThisMonth + images.length > 500) {
        console.log(
          colors.red("compressions this month is over follow (> 500).")
        )
      } else {
        const left = 500 - compressionsThisMonth
        console.log(colors.yellow("compressions this month left " + left))
      }

      resolve("tinyPng is valid.")
    })
  })
github Croc-ye / tinyhere / libs / compress.js View on Github external
const checkCompressionCount = (count = 0)=> {
    return (500 - tinify.compressionCount - count) >> 0;
}

tinify

Node.js client for the Tinify API. Tinify compresses your images intelligently. Read more at https://tinify.com.

MIT
Latest version published 2 years ago

Package Health Score

50 / 100
Full package analysis