Skip to content

Commit b7ccf7e

Browse files
committed
fix: readFile returns UInt8Array instead of Buffer
BREAKING CHANGE: Reduces UMD build size from 34kb to 12kb so I think its worth it.
1 parent 61c5d80 commit b7ccf7e

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

src/__tests__/fs.spec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@ describe("fs module", () => {
6363
});
6464
it("read file", done => {
6565
fs.mkdir("/readFile", err => {
66-
fs.writeFile("/readFile/readFile-buffer.txt", "HELLO", err => {
66+
fs.writeFile("/readFile/readFile-uint8.txt", "HELLO", err => {
6767
expect(err).toBe(null);
68-
fs.readFile("/readFile/readFile-buffer.txt", (err, data) => {
68+
fs.readFile("/readFile/readFile-uint8.txt", (err, data) => {
6969
expect(err).toBe(null);
70-
expect(data).toEqual(Buffer.from(HELLO));
70+
expect(data).toEqual(HELLO);
7171
done();
7272
});
7373
});

src/index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,6 @@ module.exports = class FS {
105105
if (data) {
106106
if (encoding === "utf8") {
107107
data = decode(data);
108-
} else {
109-
data = Buffer.from(data);
110108
}
111109
}
112110
cb(null, data);

0 commit comments

Comments
 (0)