Files
bun.sh/test/js/bun/util/bun-file-read.test.ts
2024-09-03 21:32:52 -07:00

12 lines
383 B
TypeScript

import { expect, it } from "bun:test";
import { tmpdir } from "node:os";
it("offset should work in Bun.file() #4963", async () => {
const filename = tmpdir() + "/bun.test.offset.txt";
await Bun.write(filename, "contents");
const file = Bun.file(filename);
const slice = file.slice(2, file.size);
const contents = await slice.text();
expect(contents).toBe("ntents");
});