From ab7183217a33323c991ab5c3b04caec32954d9ee Mon Sep 17 00:00:00 2001 From: Jarred Sumner Date: Wed, 30 Mar 2022 20:50:12 -0700 Subject: [bun.js] Support `file://` URLs in node fs --- integration/bunjs-only-snippets/fs.test.js | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'integration/bunjs-only-snippets/fs.test.js') diff --git a/integration/bunjs-only-snippets/fs.test.js b/integration/bunjs-only-snippets/fs.test.js index 4c048d199..4ee4c652a 100644 --- a/integration/bunjs-only-snippets/fs.test.js +++ b/integration/bunjs-only-snippets/fs.test.js @@ -30,6 +30,14 @@ describe("readFileSync", () => { expect(text).toBe("File read successfully"); }); + it("works with a file url", () => { + const text = readFileSync( + new URL("file://" + import.meta.dir + "/readFileSync.txt"), + "utf8" + ); + expect(text).toBe("File read successfully"); + }); + it("returning Buffer works", () => { const text = readFileSync(import.meta.dir + "/readFileSync.txt"); const encoded = [ -- cgit v1.2.3