Skip to content

Commit

Permalink
Merge upstream changes
Browse files Browse the repository at this point in the history
  • Loading branch information
zachleat authored Oct 1, 2024
1 parent f9fdd59 commit f7866c3
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions src/format-hooks/svg.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,8 @@ const fsp = require("fs").promises;
module.exports = async function createSvg(sharpInstance) {
let input = sharpInstance.options.input;
let svgBuffer = input.buffer;

if(svgBuffer) { // remote URL already has buffer
let svgString = svgBuffer.toString("utf-8")

if(!svgString.includes('<svg')) {
// based on https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder#examples
let utf8decoder = new TextDecoder()
svgString = utf8decoder.decode(svgBuffer)
}
return svgString
return svgBuffer;
} else { // local file system
return fsp.readFile(input.file);
}
Expand Down

0 comments on commit f7866c3

Please sign in to comment.