From c16425b2f6f3a482b0f2a7a50b7e8ad94be4b5d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=B1=B3=E7=A9=BA=E6=A0=BC?= Date: Sun, 18 Jun 2023 10:15:26 +0800 Subject: [PATCH] Update README.md Here, the file needs to be read as a raw buffer, and there is no need to specify the encoding parameter. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 07457328..b1413370 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,7 @@ convert its data into a base64-encoded data URI: import { promises as fs } from "fs"; // Read the file into a buffer -const data = await fs.readFile("path/to/image.png", "utf-8"); +const data = await fs.readFile("path/to/image.png"); // Convert the buffer into a base64-encoded string const base64 = data.toString("base64"); // Set MIME type for PNG image