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.
- 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.
| Language | File |
|---|---|
| TypeScript | typescript/plcbundle.ts |
| Python | python/plcbundle.py |
| Ruby | ruby/plcbundle.rb |
File: typescript/plcbundle.ts
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 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_bundlesDeno 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_bundlesIf 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_bundlesFile: python/plcbundle.py
TODO
File: ruby/plcbundle.rb
You need Ruby installed (version 3+ recommended).
The script relies on two external gems for HTTP requests and Zstandard compression.
# Install required gems
gem install zstd-rubyRun 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