mirror of
https://github.com/denoland/deno.git
synced 2025-09-27 20:59:10 +00:00
BREAKING: Include limited metadata in 'DirEntry' objects (#4941)
This change is to prevent needed a separate stat syscall for each file when using readdir. For consistency, this PR also modifies std's `WalkEntry` interface to extend `DirEntry` with an additional `path` field.
This commit is contained in:
parent
721a4ad59d
commit
3e6ea62841
14 changed files with 193 additions and 206 deletions
|
@ -4,19 +4,14 @@ import { unitTest, assert, assertEquals } from "./test_util.ts";
|
|||
function assertSameContent(files: Deno.DirEntry[]): void {
|
||||
let counter = 0;
|
||||
|
||||
for (const file of files) {
|
||||
if (file.name === "subdir") {
|
||||
assert(file.isDirectory);
|
||||
counter++;
|
||||
}
|
||||
|
||||
if (file.name === "002_hello.ts") {
|
||||
assertEquals(file.mode!, Deno.statSync(`cli/tests/${file.name}`).mode!);
|
||||
for (const entry of files) {
|
||||
if (entry.name === "subdir") {
|
||||
assert(entry.isDirectory);
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
|
||||
assertEquals(counter, 2);
|
||||
assertEquals(counter, 1);
|
||||
}
|
||||
|
||||
unitTest({ perms: { read: true } }, function readdirSyncSuccess(): void {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue