Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PLC Bundle V1 Example Implementations

This set of scripts represents a compact, readable example implementations for creating PLC Bundle v1 archives. It fetches operations from the PLC directory and generates a complete, verifiable repository of data bundles.

It is fully compliant with the PLC Bundle v1 Specification.

Features

  • Spec Compliant: Correctly implements hashing, chaining, serialization, and boundary de-duplication.
  • Reproducible: Generates byte-for-byte identical bundles to the other implementations.
  • Standalone: Single-file script with clear dependencies.

Implementations

Language File
TypeScript typescript/plcbundle.ts
Python python/plcbundle.py
Ruby ruby/plcbundle.rb

TypeScript

File: typescript/plcbundle.ts

Usage

This script should run well with Bun (recommended), Deno, or Node.js.

The script accepts one optional argument: the path to the output directory where bundles will be stored. If omitted, it defaults to ./plc_bundles.

Bun (Recommended)

Bun is the fastest and easiest way to run this script, as it handles TypeScript and dependencies automatically.

# Install dependencies
bun install

# Run the script to create bundles in ./my_plc_bundles
bun run plcbundle.ts ./my_plc_bundles

Deno

Deno can also run the script directly. You will need to provide permissions for network access and file system I/O.

# Run the script with Deno
deno run --allow-net --allow-read --allow-write plcbundle.ts ./my_plc_bundles

Node.js (with TypeScript)

If using Node.js, you must first install dependencies and compile the TypeScript file to JavaScript.

# Install dependencies
npm install

# Compile the script
npx tsc

# Run the compiled JavaScript
node dist/plcbundle.js ./my_plc_bundles

Python

File: python/plcbundle.py

Usage

TODO

Ruby

File: ruby/plcbundle.rb

Prerequisites

You need Ruby installed (version 3+ recommended).

Installation

The script relies on two external gems for HTTP requests and Zstandard compression.

# Install required gems
gem install zstd-ruby

Usage

Run the script from your terminal. It accepts one optional argument: the path to the output directory.

# Run and save bundles to the default './plc_bundles_rb' directory
ruby plcbundle.rb

# Run and save to a custom directory
ruby plcbundle.rb ./my_ruby_bundles

Contributors

Languages