NodeVirtualProvider.ts overview

Direct Node 26.11.1 VirtualProvider binding. Construction never mounts a filesystem.

Since v0.1.0


constructors

bind

Binds a qualified volume for this scope. Does not mount or install global hooks.

Example

import * as NodeVirtualProvider from "@effect-vfs/node/NodeVirtualProvider"
import * as Vfs from "@effect-vfs/core/VirtualFileSystem"
import * as Effect from "effect/Effect"
 
const readThroughNode = Effect.scoped(
  Effect.gen(function* () {
    const volume = yield* Vfs.make({ execution: "sync" })
    const provider = yield* NodeVirtualProvider.bind(volume, { readonly: true })
    return provider.statSync("/").isDirectory()
  })
)

Signature

declare const bind: (
  volume: Volume,
  options?: {
    readonly readonly?: boolean
    readonly caller?: {
      readonly identity?: {
        readonly uid: number
        readonly gid: number
        readonly groups: ReadonlyArray<number>
        readonly privileged: boolean
      }
      readonly umask?: number
    }
  }
) => Effect.Effect<Provider, FsFailure, Scope.Scope>

Source

Since v0.1.0

models

Options (type alias)

Provider policy decoded from the Options schema.

Signature

export type Options = {
  readonly readonly?: boolean
  readonly caller?: {
    readonly identity?: {
      readonly uid: number
      readonly gid: number
      readonly groups: readonly number[]
      readonly privileged: boolean
    }
    readonly umask?: number
  }
}

Source

Since v0.1.0

Provider (class)

A provider over an existing synchronous volume. Node allocates numeric descriptors above this protocol. Instances are constructed with bind and remain valid for its enclosing Effect scope.

Signature

declare class Provider { constructor(private readonly binding: Adapter.Binding, private readonly readOnly = false) }

Source

Since v0.1.0

mutate (method)

Signature

declare const mutate: (syscall: string, path: string) => void

Source

openHandle (method)

Signature

declare const openHandle: (input: string, flags: string | number, mode: number, fileOnly?: boolean) => NodeFileHandle

Source

openSync (method)

Signature

declare const openSync: (input: string, flags?: string | number, mode?: number) => NodeFileHandle

Source

open (method)

Signature

declare const open: (path: string, flags?: string | number, mode?: number) => Promise<NodeFileHandle>

Source

statSync (method)

Signature

declare const statSync: {
  (input: string, options: { readonly bigint: true }): BigIntStats
  (input: string, options?: { readonly bigint?: false | undefined }): Stats
  (input: string, options?: StatOptions): Stats | BigIntStats
}

Source

stat (method)

Signature

declare const stat: {
  (path: string, options: { readonly bigint: true }): Promise<BigIntStats>
  (path: string, options?: { readonly bigint?: false | undefined }): Promise<Stats>
  (path: string, options?: StatOptions): Promise<Stats | BigIntStats>
}

Source

lstatSync (method)

Signature

declare const lstatSync: {
  (input: string, options: { readonly bigint: true }): BigIntStats
  (input: string, options?: { readonly bigint?: false | undefined }): Stats
  (input: string, options?: StatOptions): Stats | BigIntStats
}

Source

lstat (method)

Signature

declare const lstat: {
  (path: string, options: { readonly bigint: true }): Promise<BigIntStats>
  (path: string, options?: { readonly bigint?: false | undefined }): Promise<Stats>
  (path: string, options?: StatOptions): Promise<Stats | BigIntStats>
}

Source

readdirSync (method)

Signature

declare const readdirSync: {
  (input: string, options: DirectoryEntries<"buffer"> & BufferEncodingOption): Array<Entry<Buffer>>
  (input: string, options: DirectoryEntries<BufferEncoding | null | undefined>): Array<Entry>
  (input: string, options: DirectoryEntries): Array<Entry<string | Buffer>>
  (input: string, options: DirectoryOptions<"buffer", false> & BufferEncodingOption): Array<Buffer>
  (input: string, options?: DirectoryOptions<BufferEncoding | null | undefined, false> | BufferEncoding): Array<string>
  (input: string, options?: DirectoryOptions | BufferEncoding): Array<string | Buffer | Entry<string | Buffer>>
}

Source

readdir (method)

Signature

declare const readdir: {
  (path: string, options: DirectoryEntries<"buffer"> & BufferEncodingOption): Promise<Array<Entry<Buffer>>>
  (path: string, options: DirectoryEntries<BufferEncoding | null | undefined>): Promise<Array<Entry>>
  (path: string, options: DirectoryEntries): Promise<Array<Entry<string | Buffer>>>
  (path: string, options: DirectoryOptions<"buffer", false> & BufferEncodingOption): Promise<Array<Buffer>>
  (
    path: string,
    options?: DirectoryOptions<BufferEncoding | null | undefined, false> | BufferEncoding
  ): Promise<Array<string>>
  (path: string, options?: DirectoryOptions | BufferEncoding): Promise<Array<string | Buffer | Entry<string | Buffer>>>
}

Source

mkdirSync (method)

Signature

declare const mkdirSync: (
  input: string,
  options?: { readonly mode?: number; readonly recursive?: boolean } | number
) => void

Source

mkdir (method)

Signature

declare const mkdir: (
  path: string,
  options?: { readonly mode?: number; readonly recursive?: boolean } | number
) => Promise<void>

Source

rmdirSync (method)

Signature

declare const rmdirSync: (input: string) => void

Source

rmdir (method)

Signature

declare const rmdir: (path: string) => Promise<void>

Source

unlinkSync (method)

Signature

declare const unlinkSync: (input: string) => void

Source

Signature

declare const unlink: (path: string) => Promise<void>

Source

renameSync (method)

Signature

declare const renameSync: (from: string, to: string) => void

Source

rename (method)

Signature

declare const rename: (from: string, to: string) => Promise<void>

Source

linkSync (method)

Signature

declare const linkSync: (from: string, to: string) => void

Source

Signature

declare const link: (from: string, to: string) => Promise<void>

Source

symlinkSync (method)

Signature

declare const symlinkSync: (target: string, input: string, type?: string) => void

Source

Signature

declare const symlink: (target: string, path: string, type?: string) => Promise<void>

Source

readlinkSync (method)

Signature

declare const readlinkSync: {
  (input: string, options: BufferEncodingOption): Buffer
  (input: string, options?: TextPathOptions): string
  (input: string, options?: EncodingOptions): string | Buffer
}

Source

Signature

declare const readlink: {
  (path: string, options: BufferEncodingOption): Promise<Buffer>
  (path: string, options?: TextPathOptions): Promise<string>
  (path: string, options?: EncodingOptions): Promise<string | Buffer>
}

Source

realpathSync (method)

Signature

declare const realpathSync: {
  (input: string, options: BufferEncodingOption): Buffer
  (input: string, options?: TextPathOptions): string
  (input: string, options?: EncodingOptions): string | Buffer
}

Source

realpath (method)

Signature

declare const realpath: {
  (path: string, options: BufferEncodingOption): Promise<Buffer>
  (path: string, options?: TextPathOptions): Promise<string>
  (path: string, options?: EncodingOptions): Promise<string | Buffer>
}

Source

accessSync (method)

Signature

declare const accessSync: (input: string, mode?: number) => void

Source

access (method)

Signature

declare const access: (path: string, mode?: number) => Promise<void>

Source

chmodSync (method)

Signature

declare const chmodSync: (input: string, mode: number, follow?: boolean) => void

Source

chmod (method)

Signature

declare const chmod: (path: string, mode: number) => Promise<void>

Source

lchmodSync (method)

Signature

declare const lchmodSync: (path: string, mode: number) => void

Source

lchmod (method)

Signature

declare const lchmod: (path: string, mode: number) => Promise<void>

Source

chownSync (method)

Signature

declare const chownSync: (input: string, uid: number, gid: number, follow?: boolean) => void

Source

chown (method)

Signature

declare const chown: (path: string, uid: number, gid: number) => Promise<void>

Source

lchownSync (method)

Signature

declare const lchownSync: (path: string, uid: number, gid: number) => void

Source

lchown (method)

Signature

declare const lchown: (path: string, uid: number, gid: number) => Promise<void>

Source

utimesSync (method)

Signature

declare const utimesSync: (input: string, atime: Time, mtime: Time, follow?: boolean) => void

Source

utimes (method)

Signature

declare const utimes: (path: string, atime: Time, mtime: Time) => Promise<void>

Source

lutimesSync (method)

Signature

declare const lutimesSync: (path: string, atime: Time, mtime: Time) => void

Source

lutimes (method)

Signature

declare const lutimes: (path: string, atime: Time, mtime: Time) => Promise<void>

Source

openForWholeFileRead (method)

Signature

declare const openForWholeFileRead: (path: string, flag: string | number) => NodeFileHandle

Source

readFileSync (method)

Signature

declare const readFileSync: {
  (path: string, options?: FileOptions<"buffer" | null | undefined> | null): Buffer
  (path: string, options: BufferEncoding | (FileOptions & TextEncodingOption)): string
  (path: string, options?: WholeFileOptions): string | Buffer
}

Source

readFile (method)

Signature

declare const readFile: {
  (path: string, options?: FileOptions<"buffer" | null | undefined> | null): Promise<Buffer>
  (path: string, options: BufferEncoding | (FileOptions & TextEncodingOption)): Promise<string>
  (path: string, options?: WholeFileOptions): Promise<string | Buffer>
}

Source

writeFileSync (method)

Signature

declare const writeFileSync: (path: string, data: string | Uint8Array, options?: WholeFileOptions) => void

Source

writeFile (method)

Signature

declare const writeFile: (path: string, data: string | Uint8Array, options?: WholeFileOptions) => Promise<void>

Source

appendFileSync (method)

Signature

declare const appendFileSync: (path: string, data: string | Uint8Array, options?: WholeFileOptions) => void

Source

appendFile (method)

Signature

declare const appendFile: (path: string, data: string | Uint8Array, options?: WholeFileOptions) => Promise<void>

Source

existsSync (method)

Signature

declare const existsSync: (path: string) => boolean

Source

exists (method)

Signature

declare const exists: (path: string) => Promise<boolean>

Source

copyFileSync (method)

Signature

declare const copyFileSync: (src: string, dest: string, mode?: number) => void

Source

copyFile (method)

Signature

declare const copyFile: (src: string, dest: string, mode?: number) => Promise<void>

Source

watch (method)

Signature

declare const watch: () => never

Source

watchAsync (method)

Signature

declare const watchAsync: () => never

Source

watchFile (method)

Signature

declare const watchFile: () => never

Source

unwatchFile (method)

Signature

declare const unwatchFile: () => never

Source

statfsSync (method)

Signature

declare const statfsSync: () => never

Source

statfs (method)

Signature

declare const statfs: () => Promise<never>

Source

schemas

Options

Provider policy, independent of the backing volume's other callers.

Signature

declare const Options: Schema.Struct<{
  readonly readonly: Schema.optionalKey<Schema.Boolean>
  readonly caller: Schema.optionalKey<
    Schema.Struct<{
      readonly identity: Schema.optionalKey<
        Schema.Struct<{
          readonly uid: Schema.Natural
          readonly gid: Schema.Natural
          readonly groups: Schema.$Array<Schema.Natural>
          readonly privileged: Schema.Boolean
        }>
      >
      readonly umask: Schema.optionalKey<Schema.Natural>
    }>
  >
}>

Source

Since v0.1.0