MCPcopy Create free account
hub / github.com/Effect-TS/effect / makeFileInfo

Function makeFileInfo

packages/platform/node-shared/src/NodeFileSystem.ts:611–633  ·  view source on GitHub ↗
(
  stat: NFS.BigIntStats,
  method = "stat"
)

Source from the content-addressed store, hash-verified

609 "Unknown"
610
611const makeFileInfo = (
612 stat: NFS.BigIntStats,
613 method = "stat"
614): Effect.Effect<FileSystem.File.Info, Error.PlatformError> =>
615 Effect.try({
616 try: (): FileSystem.File.Info => ({
617 type: fileType(stat),
618 mtime: Option.fromNullishOr(stat.mtime),
619 atime: Option.fromNullishOr(stat.atime),
620 birthtime: Option.fromNullishOr(stat.birthtime),
621 dev: toUint64(stat.dev),
622 rdev: toUint64Option(stat.rdev),
623 ino: toUint64Option(stat.ino),
624 mode: bigintToNumber(stat.mode, "mode"),
625 nlink: toUint64Option(stat.nlink),
626 uid: bigintToNumberOption(stat.uid),
627 gid: bigintToNumberOption(stat.gid),
628 size: ByteSize.bytes(stat.size),
629 blksize: stat.blksize !== undefined ? Option.some(ByteSize.bytes(stat.blksize)) : Option.none(),
630 blocks: Option.fromNullishOr(stat.blocks)
631 }),
632 catch: handleBadArgument(method)
633 })
634const statFactory = (method: string, nodeStatFn: typeof NFS.stat) => {
635 const nodeStat = effectify(
636 nodeStatFn,

Callers 1

statFactoryFunction · 0.70

Calls 8

toUint64Function · 0.85
toUint64OptionFunction · 0.85
bigintToNumberFunction · 0.85
bigintToNumberOptionFunction · 0.85
handleBadArgumentFunction · 0.85
someMethod · 0.80
fileTypeFunction · 0.70
bytesMethod · 0.45

Tested by

no test coverage detected