Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

svgCompressionSize: "br" with remote SVG image gives error #201

Open
saneef opened this issue Dec 1, 2023 · 0 comments
Open

svgCompressionSize: "br" with remote SVG image gives error #201

saneef opened this issue Dec 1, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@saneef
Copy link

saneef commented Dec 1, 2023

When using remote SVG Image with svgShortCircuit: "size" and svgCompressionSize: "br", I'm getting error. Works fine with a local SVG file.

Here is the code I use to reproduce the error:

const Image = require("@11ty/eleventy-img");

(async () => {
  // const path = "./Ghostscript_Tiger.svg"; 👈 Local image works

  const path =
    "https://upload.wikimedia.org/wikipedia/commons/f/fd/Ghostscript_Tiger.svg";

  let metadata = await Image(path, {
    widths: [300, 450, 600],
    formats: ["avif", "webp", "svg", "jpeg"],
    svgShortCircuit: "size",
    svgCompressionSize: "br",
  });

  console.log(metadata);
})();

...and, here is the error I get:

node:internal/errors:496
    ErrorCaptureStackTrace(err);
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "buffer" argument must be of type string or an instance of Buffer, TypedArray, DataView, or ArrayBuffer. Received type boolean (false)
    at new NodeError (node:internal/errors:405:5)
    at zlibBufferSync (node:zlib:171:13)
    at Object.syncBufferWrapper [as brotliCompressSync] (node:zlib:792:14)
    at Object.sync (▋▋▋▋▋/node_modules/brotli-size/dist/index.js:41:19)
    at Image.resize (▋▋▋▋▋/node_modules/@11ty/eleventy-img/img.js:522:36)
    at async run (▋▋▋▋▋/node_modules/p-queue/dist/index.js:163:29) {
  code: 'ERR_INVALID_ARG_TYPE'
}
@zachleat zachleat added the bug Something isn't working label Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants