node

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 3, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package node opens JSONL durable storage on the local file system, the Go counterpart of Pi's Node JSONL adapter.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OpenNodeJsonlStorage

func OpenNodeJsonlStorage(
	ctx context.Context, directory string, options jsonl.JsonlStorageOptions,
) (*jsonl.JsonlStorage, error)

OpenNodeJsonlStorage opens or creates a JSONL storage directory on the local file system, resolving a relative directory against the process working directory.

Types

type NodeFileSystem

type NodeFileSystem struct {
	Cwd string
}

NodeFileSystem is the local file system as JSONL storage uses it. Its operations follow the file half of Pi's NodeExecutionEnv (packages/durable/src/env/node.ts): paths resolve against Cwd, and failures are *env.FileError.

func (*NodeFileSystem) AbsolutePath

func (fileSystem *NodeFileSystem) AbsolutePath(_ context.Context, path string) (string, error)

AbsolutePath resolves path against Cwd.

func (*NodeFileSystem) AppendFile

func (fileSystem *NodeFileSystem) AppendFile(ctx context.Context, path string, content any) error

AppendFile appends to a file, creating it and its parent directory.

func (*NodeFileSystem) CreateDir

func (fileSystem *NodeFileSystem) CreateDir(ctx context.Context, path string, options *env.CreateDirOptions) error

CreateDir creates a directory; options default to recursive.

func (*NodeFileSystem) FlushFile

func (fileSystem *NodeFileSystem) FlushFile(ctx context.Context, path string) error

FlushFile flushes a file's contents and the metadata needed to retrieve them.

func (*NodeFileSystem) JoinPath

func (fileSystem *NodeFileSystem) JoinPath(_ context.Context, parts []string) (string, error)

JoinPath joins and cleans path parts.

func (*NodeFileSystem) ListDir

func (fileSystem *NodeFileSystem) ListDir(ctx context.Context, path string) ([]env.FileInfo, error)

ListDir lists a directory's entries without following symbolic links.

func (*NodeFileSystem) ReadBinaryFile

func (fileSystem *NodeFileSystem) ReadBinaryFile(ctx context.Context, path string) ([]byte, error)

ReadBinaryFile reads a whole file.

func (*NodeFileSystem) Remove

func (fileSystem *NodeFileSystem) Remove(ctx context.Context, path string, options *env.RemoveOptions) error

Remove removes a file or, with Recursive, a tree; Force ignores a missing path.

func (*NodeFileSystem) RenameFile

func (fileSystem *NodeFileSystem) RenameFile(ctx context.Context, sourcePath, destinationPath string) error

RenameFile renames a file, replacing the destination.

func (*NodeFileSystem) TruncateFile

func (fileSystem *NodeFileSystem) TruncateFile(ctx context.Context, path string, size int64) error

TruncateFile truncates or extends a file to exactly size bytes.

func (*NodeFileSystem) WriteFile

func (fileSystem *NodeFileSystem) WriteFile(ctx context.Context, path string, content any) error

WriteFile replaces a file's content, creating its parent directory.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL