GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||
GeezerVison is showing github.com — File blob is not invalidated if the file was initially empty then written to · Issue #47161 · nodejs/node Closed Closed Copy link Labels fsIssues and PRs related to file-system APIs and the fs module.Issues and PRs related to file-system APIs and the fs module. DescriptionVersionv19.8.1 PlatformLinux 5.19.0-35-generic #36~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Feb 17 15:17:25 UTC 2 x86_64 x86_64 x86_64 GNU/Linux Subsystemfs What steps will reproduce the bug?The following should produce an exception when reading the blob, but currently doesn't: import fs from "node:fs"; // Create an empty file fs.writeFileSync("./test.txt", ""); const blob = await fs.openAsBlob("./test.txt"); // write to the file, which should invalidate the blob fs.writeFileSync("./test.txt", "foobar"); // This should throw an error, but returns the empty string instead const result = await blob.text(); console.log(JSON.stringify(result)); How often does it reproduce? Is there a required condition?This happens consistently. What is the expected behavior? Why is that the expected behavior?It should throw a import fs from "node:fs"; // Create an empty file fs.writeFileSync("./test.txt", "NOT_EMPTY"); const blob = await fs.openAsBlob("./test.txt"); // write to the file, which should invalidate the blob fs.writeFileSync("./test.txt", "foobar"); // This should throw an error, but returns the empty string instead const result = await blob.text(); console.log(JSON.stringify(result)); What do you see instead?No exception is thrown. Additional informationThe Chrome behaviour for empty files being read after modification is the same as for non-empty files — i.e. an error is thrown in all cases. (Curiously the Firefox behaviour allows reading the latest contents of the file regardless of modification status, however this seems buggy as the blob Activity
MetadataMetadataAssigneesLabelsfsIssues and PRs related to file-system APIs and the fs module.Issues and PRs related to file-system APIs and the fs module. TypeProjectsMilestoneRelationshipsDevelopmentIssue actions | ||||||||||||||||
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |