CodeSampleX

Beispiel

pvutils 1.2.0: utilConcatBuf

Verifiziertes Beispiel für npm pvutils 1.2.0: utilConcatBuf. Der Vertrag lief auf node 22 · linux debian/x64 · docker und bestand.

sha256:d4f7fff63608a070c4a6ec53fd70599b2899eb11a0e428be839aa97dd2b57299

Dieses Netzwerk bietet eine Sache: ein Sample, das baut. Es hat es in einer Sandbox ausgeführt und die signierte Quittung behalten. Es bewertet nichts und garantiert nichts — ob derselbe Code bei Ihnen baut, hat es nicht gemessen. Wie viele verschiedene Signaturschlüssel eine bestandene Vertragsquittung eingereicht haben. Einer ist der Autor allein; mehr als einer heißt, jemand anderes hat es auch gebaut. Ein Schlüssel wird selbst erzeugt und hat keine registrierte Identität dahinter — gezählt werden Schlüssel, nicht Personen. MIT-0

Ausführungsbelege

Die deklarierte Umgebung und die signierten Läufe stehen getrennt, damit Sie genau sehen, was dieses Sample ausgeführt hat und wo.

Beleggrundlage
Signierter Vertrag bestanden
Verifizierungsbelege
1
Signaturschlüssel, die es gebaut haben
1
Deklarierte Umgebung linux 24 · ubuntu · glibc 2.39 x64 npm

Umgebungen der Verifizierungsläufe

Umgebung Contract Stufen Lauf
node 22 · linux debian/x64 · docker ed25519:c1973797be207ac4 PASS compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS
CONTAINER_RUN · node-typescript@1node:22@sha256:8a34c4ab3ea2…
2026-09-06

Fall

HOW
Ziel
verify pvutils.utilConcatBuf in pkg:npm/pvutils@1.2.0
Pakete
Symbole
  • pvutils.utilConcatBuf
Erstellt
2026-09-06T02:43:36Z

Contract

  1. utilConcatBuf concatenates multiple ArrayBuffer instances into a single contiguous ArrayBuffer
  2. utilConcatBuf preserves byte ordering and element values across joined buffers
  3. utilConcatBuf returns an empty ArrayBuffer when invoked with zero arguments or empty buffers
  4. utilConcatBuf returns an equivalent ArrayBuffer when given a single buffer argument

Dateien

  • PROMPT.md
  • csx.json
  • package-lock.json
  • package.json
  • spec.json
  • src/index.js
  • test/contract.mjs

Quellartefakt herunterladen (tar.gz)

Quelltext

PROMPT.md
Clean-room public code sample — generation instructions

Write a brand-new, minimal, self-contained code sample in this clean-room directory.
Do not copy, paraphrase, or reference any existing project source. Work only from this spec.

A csx.json manifest scaffold already exists. Do not recreate it from memory. Preserve its case.goal, packages and symbols; fill its empty case.contract with exact assertions and correct its environment, commands and verifierAdapter for the files you generate.

Goal: verify pvutils.utilConcatBuf in pkg:npm/pvutils@1.2.0
Kind: HOW

Use EXACTLY these public packages and versions:
  - pkg:npm/pvutils@1.2.0
Demonstrate these symbols/APIs:
  - pvutils.utilConcatBuf

Rules:
  - One focused purpose; the smallest project that proves the goal.
  - Include a contract test (test/contract.*) that runs OFFLINE and exits 0 exactly when the goal behavior works.
  - Pin every dependency with a lockfile so resolution is reproducible.
  - No secrets, credentials, or tokens. No real URLs (only example.com or localhost). No absolute paths.
  - No personal names, emails, company names, or project identifiers of any kind.
  - No binaries and no generated output (node_modules, dist, target, venv, .git, .env).
  - Keep it under 200 files and 256KB packed.
csx.json
{"case":{"caseId":"case:sha256:c7edd3aefd5c095c454b060e29c5d0805fc4c8a2cc31f63c306e6da6b6f53e80","contract":["utilConcatBuf concatenates multiple ArrayBuffer instances into a single contiguous ArrayBuffer","utilConcatBuf preserves byte ordering and element values across joined buffers","utilConcatBuf returns an empty ArrayBuffer when invoked with zero arguments or empty buffers","utilConcatBuf returns an equivalent ArrayBuffer when given a single buffer argument"],"goal":"verify pvutils.utilConcatBuf in pkg:npm/pvutils@1.2.0","kind":"HOW","packages":["pkg:npm/pvutils@1.2.0"],"schemaVersion":1,"symbols":["pvutils.utilConcatBuf"]},"contractCommand":["node","test/contract.mjs"],"environment":{"arch":"x64","distro":"ubuntu","ecosystem":"npm","libc":"glibc","libcVersion":"2.39","os":"linux","osVersionBucket":"24","packageManager":"npm","schemaVersion":1},"license":"MIT-0","packages":["pkg:npm/pvutils@1.2.0"],"schemaVersion":1,"subject":"pkg:npm/pvutils@1.2.0","symbols":["pvutils.utilConcatBuf"],"verifierAdapter":"node-typescript@1"}
package-lock.json
{
  "name": "sample-pvutils",
  "version": "1.0.0",
  "lockfileVersion": 3,
  "requires": true,
  "packages": {
    "": {
      "name": "sample-pvutils",
      "version": "1.0.0",
      "dependencies": {
        "pvutils": "1.2.0"
      }
    },
    "node_modules/pvutils": {
      "version": "1.2.0",
      "resolved": "https://registry.npmjs.org/pvutils/-/pvutils-1.2.0.tgz",
      "integrity": "sha512-BbubeCEyTuQjVMakvJQ/Sxbc93F2pwmbsxONT/ZRrwU7Ua38d8unYTwXpTVLAKJ4BDuH9IGztCjQcd/N/39Dvg==",
      "license": "MIT",
      "engines": {
        "node": ">=16.0.0"
      }
    }
  }
}
package.json
{
  "name": "sample-pvutils",
  "version": "1.0.0",
  "private": true,
  "description": "Clean-room verification of pvutils.utilConcatBuf",
  "type": "module",
  "main": "src/index.js",
  "dependencies": {
    "pvutils": "1.2.0"
  }
}
spec.json
{
  "schemaVersion": 1,
  "goal": "verify pvutils.utilConcatBuf in pkg:npm/pvutils@1.2.0",
  "kind": "HOW",
  "packages": [
    "pkg:npm/pvutils@1.2.0"
  ],
  "symbols": [
    "pvutils.utilConcatBuf"
  ]
}
src/index.js
import { utilConcatBuf } from 'pvutils';

/**
 * Concatenate multiple ArrayBuffers into a single contiguous ArrayBuffer.
 * @param {...ArrayBuffer} buffers
 * @returns {ArrayBuffer}
 */
export function concatBuffers(...buffers) {
  return utilConcatBuf(...buffers);
}

export { utilConcatBuf };
test/contract.mjs
import assert from 'node:assert';
import { utilConcatBuf, concatBuffers } from '../src/index.js';

// 1. utilConcatBuf concatenates multiple ArrayBuffer instances into a single contiguous ArrayBuffer
{
  const buf1 = new Uint8Array([1, 2, 3]).buffer;
  const buf2 = new Uint8Array([4, 5]).buffer;
  const buf3 = new Uint8Array([6, 7, 8, 9]).buffer;
  const result = utilConcatBuf(buf1, buf2, buf3);

  assert.strictEqual(result instanceof ArrayBuffer, true);
  assert.strictEqual(result.byteLength, 9);
  assert.deepStrictEqual(Array.from(new Uint8Array(result)), [1, 2, 3, 4, 5, 6, 7, 8, 9]);
}

// 2. utilConcatBuf preserves byte ordering and element values across joined buffers
{
  const first = new Uint8Array([0xaa, 0xbb]).buffer;
  const second = new Uint8Array([0xcc, 0xdd, 0xee]).buffer;
  const merged = concatBuffers(first, second);

  assert.strictEqual(merged.byteLength, 5);
  const view = new Uint8Array(merged);
  assert.strictEqual(view[0], 0xaa);
  assert.strictEqual(view[1], 0xbb);
  assert.strictEqual(view[2], 0xcc);
  assert.strictEqual(view[3], 0xdd);
  assert.strictEqual(view[4], 0xee);
}

// 3. utilConcatBuf returns an empty ArrayBuffer when invoked with zero arguments or empty buffers
{
  const noArgs = utilConcatBuf();
  assert.strictEqual(noArgs instanceof ArrayBuffer, true);
  assert.strictEqual(noArgs.byteLength, 0);

  const emptyA = new ArrayBuffer(0);
  const emptyB = new ArrayBuffer(0);
  const emptyMerged = utilConcatBuf(emptyA, emptyB);
  assert.strictEqual(emptyMerged instanceof ArrayBuffer, true);
  assert.strictEqual(emptyMerged.byteLength, 0);
}

// 4. utilConcatBuf returns an equivalent ArrayBuffer when given a single buffer argument
{
  const single = new Uint8Array([42, 43, 44]).buffer;
  const result = utilConcatBuf(single);

  assert.strictEqual(result instanceof ArrayBuffer, true);
  assert.strictEqual(result.byteLength, 3);
  assert.deepStrictEqual(Array.from(new Uint8Array(result)), [42, 43, 44]);
}

console.log('All pvutils.utilConcatBuf contract assertions passed.');

Ursprungs-Seeder

anonym