JSPM

squoosh-browser-sense

1.0.7
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 27
  • Score
    100M100P100Q72207F
  • License MIT

An image compression tool run in browser while @squoosh/lib can not.

Package Exports

  • squoosh-browser-sense
  • squoosh-browser-sense/dist/client/lazy-app/Compress/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (squoosh-browser-sense) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

squoosh-browser

An image compression tool run in browser while @squoosh/lib can not.

origin

Squoosh is an image compression web app that reduces image sizes through numerous formats.

Since @squoosh/lib can not run in browser, squoosh-browser is designed to solve it.

It can process almost all image formats, such as "pdf", "gif", "png", "jpeg", "bmp", "tiff", "webp", "webp2", "avif", "jxl".

installation

yarn add @yireen/squoosh-browser

If you use webpack4, you also need

yarn add file-loader --dev

config

For webpack5

// webpack.config.js
module: {
  rules: [
    {
      test: /\.wasm/,
      type: 'asset/resource'
    }
  ]
}

For webpack4

// webpack.config.js
module: {
  rules: [
    {
      test: /\.wasm/,
      use: [
        {
          loader: 'file-loader'
        }
      ]
    }
  ]
}

usage

import Compress from '@yireen/squoosh-browser'

  const compress = new Compress(image);
  const compressFile = await compress.process();
}