diff options
author | 2022-03-30 20:50:12 -0700 | |
---|---|---|
committer | 2022-03-30 20:50:12 -0700 | |
commit | ab7183217a33323c991ab5c3b04caec32954d9ee (patch) | |
tree | 69a0dbeaf1109f73b8a8b556c321dd2af25ce752 /integration/bunjs-only-snippets/fs.test.js | |
parent | 47a9a452d8ff4d6876d389df2205507a383d5dc8 (diff) | |
download | bun-ab7183217a33323c991ab5c3b04caec32954d9ee.tar.gz bun-ab7183217a33323c991ab5c3b04caec32954d9ee.tar.zst bun-ab7183217a33323c991ab5c3b04caec32954d9ee.zip |
[bun.js] Support `file://` URLs in node fs
Diffstat (limited to 'integration/bunjs-only-snippets/fs.test.js')
-rw-r--r-- | integration/bunjs-only-snippets/fs.test.js | 8 |
1 files changed, 8 insertions, 0 deletions
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 = [ |