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>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
}
}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) }Since v0.1.0
mutate (method)
Signature
declare const mutate: (syscall: string, path: string) => voidopenHandle (method)
Signature
declare const openHandle: (input: string, flags: string | number, mode: number, fileOnly?: boolean) => NodeFileHandleopenSync (method)
Signature
declare const openSync: (input: string, flags?: string | number, mode?: number) => NodeFileHandleopen (method)
Signature
declare const open: (path: string, flags?: string | number, mode?: number) => Promise<NodeFileHandle>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
}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>
}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
}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>
}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>>
}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>>>
}mkdirSync (method)
Signature
declare const mkdirSync: (
input: string,
options?: { readonly mode?: number; readonly recursive?: boolean } | number
) => voidmkdir (method)
Signature
declare const mkdir: (
path: string,
options?: { readonly mode?: number; readonly recursive?: boolean } | number
) => Promise<void>rmdirSync (method)
Signature
declare const rmdirSync: (input: string) => voidrmdir (method)
Signature
declare const rmdir: (path: string) => Promise<void>unlinkSync (method)
Signature
declare const unlinkSync: (input: string) => voidunlink (method)
Signature
declare const unlink: (path: string) => Promise<void>renameSync (method)
Signature
declare const renameSync: (from: string, to: string) => voidrename (method)
Signature
declare const rename: (from: string, to: string) => Promise<void>linkSync (method)
Signature
declare const linkSync: (from: string, to: string) => voidlink (method)
Signature
declare const link: (from: string, to: string) => Promise<void>symlinkSync (method)
Signature
declare const symlinkSync: (target: string, input: string, type?: string) => voidsymlink (method)
Signature
declare const symlink: (target: string, path: string, type?: string) => Promise<void>readlinkSync (method)
Signature
declare const readlinkSync: {
(input: string, options: BufferEncodingOption): Buffer
(input: string, options?: TextPathOptions): string
(input: string, options?: EncodingOptions): string | Buffer
}readlink (method)
Signature
declare const readlink: {
(path: string, options: BufferEncodingOption): Promise<Buffer>
(path: string, options?: TextPathOptions): Promise<string>
(path: string, options?: EncodingOptions): Promise<string | Buffer>
}realpathSync (method)
Signature
declare const realpathSync: {
(input: string, options: BufferEncodingOption): Buffer
(input: string, options?: TextPathOptions): string
(input: string, options?: EncodingOptions): string | Buffer
}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>
}accessSync (method)
Signature
declare const accessSync: (input: string, mode?: number) => voidaccess (method)
Signature
declare const access: (path: string, mode?: number) => Promise<void>chmodSync (method)
Signature
declare const chmodSync: (input: string, mode: number, follow?: boolean) => voidchmod (method)
Signature
declare const chmod: (path: string, mode: number) => Promise<void>lchmodSync (method)
Signature
declare const lchmodSync: (path: string, mode: number) => voidlchmod (method)
Signature
declare const lchmod: (path: string, mode: number) => Promise<void>chownSync (method)
Signature
declare const chownSync: (input: string, uid: number, gid: number, follow?: boolean) => voidchown (method)
Signature
declare const chown: (path: string, uid: number, gid: number) => Promise<void>lchownSync (method)
Signature
declare const lchownSync: (path: string, uid: number, gid: number) => voidlchown (method)
Signature
declare const lchown: (path: string, uid: number, gid: number) => Promise<void>utimesSync (method)
Signature
declare const utimesSync: (input: string, atime: Time, mtime: Time, follow?: boolean) => voidutimes (method)
Signature
declare const utimes: (path: string, atime: Time, mtime: Time) => Promise<void>lutimesSync (method)
Signature
declare const lutimesSync: (path: string, atime: Time, mtime: Time) => voidlutimes (method)
Signature
declare const lutimes: (path: string, atime: Time, mtime: Time) => Promise<void>openForWholeFileRead (method)
Signature
declare const openForWholeFileRead: (path: string, flag: string | number) => NodeFileHandlereadFileSync (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
}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>
}writeFileSync (method)
Signature
declare const writeFileSync: (path: string, data: string | Uint8Array, options?: WholeFileOptions) => voidwriteFile (method)
Signature
declare const writeFile: (path: string, data: string | Uint8Array, options?: WholeFileOptions) => Promise<void>appendFileSync (method)
Signature
declare const appendFileSync: (path: string, data: string | Uint8Array, options?: WholeFileOptions) => voidappendFile (method)
Signature
declare const appendFile: (path: string, data: string | Uint8Array, options?: WholeFileOptions) => Promise<void>existsSync (method)
Signature
declare const existsSync: (path: string) => booleanexists (method)
Signature
declare const exists: (path: string) => Promise<boolean>copyFileSync (method)
Signature
declare const copyFileSync: (src: string, dest: string, mode?: number) => voidcopyFile (method)
Signature
declare const copyFile: (src: string, dest: string, mode?: number) => Promise<void>watch (method)
Signature
declare const watch: () => neverwatchAsync (method)
Signature
declare const watchAsync: () => neverwatchFile (method)
Signature
declare const watchFile: () => neverunwatchFile (method)
Signature
declare const unwatchFile: () => neverstatfsSync (method)
Signature
declare const statfsSync: () => neverstatfs (method)
Signature
declare const statfs: () => Promise<never>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>
}>
>
}>Since v0.1.0