effect-io-ai

Package: effect
Module: FileSystem

FileSystem.SizeInput

Input type for size parameters that accepts multiple numeric types.

Details

This union type allows file system operations to accept size values in different formats for convenience, which are then normalized to the branded Size type internally.

Example (Using size inputs)

import { Effect, FileSystem } from "effect"

const program = Effect.gen(function*() {
  const fs = yield* FileSystem.FileSystem

  // All of these are valid SizeInput values
  yield* fs.truncate("file1.txt", 1024) // number
  yield* fs.truncate("file2.txt", BigInt(2048)) // bigint
  yield* fs.truncate("file3.txt", FileSystem.Size(4096)) // Size
})

Signature

type SizeInput = bigint | number | Size

Source

Since v4.0.0