Skip to content

Commit

Permalink
Use fs.constants instead of FileType enum
Browse files Browse the repository at this point in the history
  • Loading branch information
james-pre committed Jul 25, 2024
1 parent 677a1aa commit 21afcb4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/ZipFS.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { FileType, NoSyncFile, Stats, flagToMode, isWriteable, type Cred } from '@zenfs/core';
import { NoSyncFile, Stats, flagToMode, isWriteable, type Cred } from '@zenfs/core';
import { type Backend } from '@zenfs/core/backends/backend.js';
import { S_IFDIR } from '@zenfs/core/emulation/constants.js';
import { parse } from '@zenfs/core/emulation/path.js';
import { Errno, ErrnoError } from '@zenfs/core/error.js';
import { FileSystem, Readonly, Sync, type FileSystemMetadata } from '@zenfs/core/filesystem.js';
Expand Down Expand Up @@ -155,7 +156,7 @@ export class ZipFS extends Readonly(Sync(FileSystem)) {
// The EOCD/Header does not track directories, so it does not exist in `entries`
if (this.directories.has(path)) {
return new Stats({
mode: 0o555 | FileType.DIRECTORY,
mode: 0o555 | S_IFDIR,
size: 4096,
mtimeMs: this._time,
ctimeMs: this._time,
Expand Down
7 changes: 4 additions & 3 deletions src/zip.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ErrnoError, Errno } from '@zenfs/core/error.js';
import { FileType, Stats } from '@zenfs/core/stats.js';
import { S_IFDIR, S_IFREG } from '@zenfs/core/emulation/constants.js';
import { Errno, ErrnoError } from '@zenfs/core/error.js';
import { Stats } from '@zenfs/core/stats.js';
import { deserialize, sizeof, struct, types as t } from 'utilium';
import { CompressionMethod, decompressionMethods } from './compression.js';
import { msdosDate, safeDecode } from './utils.js';
Expand Down Expand Up @@ -385,7 +386,7 @@ class FileEntry {

public get stats(): Stats {
return new Stats({
mode: 0o555 | (this.isDirectory ? FileType.DIRECTORY : FileType.FILE),
mode: 0o555 | (this.isDirectory ? S_IFDIR : S_IFREG),
size: this.uncompressedSize,
mtimeMs: this.lastModified.getTime(),
});
Expand Down

0 comments on commit 21afcb4

Please sign in to comment.