PHP 8.2.30
Preview: Buffer.js Size: 795 B
/home/byroehnu/.trash/node_modules11/restructure/src/Buffer.js

import {Base} from './Base.js';
import {Number as NumberT} from './Number.js';
import * as utils from './utils.js';

export class BufferT extends Base {
  constructor(length) {
    super();
    this.length = length;
  }
  
  decode(stream, parent) {
    const length = utils.resolveLength(this.length, stream, parent);
    return stream.readBuffer(length);
  }

  size(val, parent) {
    if (!val) {
      return utils.resolveLength(this.length, null, parent);
    }

    let len = val.length;
    if (this.length instanceof NumberT) {
      len += this.length.size();
    }

    return len;
  }

  encode(stream, buf, parent) {
    if (this.length instanceof NumberT) {
      this.length.encode(stream, buf.length);
    }

    return stream.writeBuffer(buf);
  }
}

export {BufferT as Buffer};

Directory Contents

Dirs: 0 × Files: 17

Name Size Perms Modified Actions
2.43 KB lrw-r--r-- 2026-02-14 19:19:14
Edit Download
412 B lrw-r--r-- 2026-02-14 19:19:14
Edit Download
741 B lrw-r--r-- 2026-02-14 19:19:14
Edit Download
398 B lrw-r--r-- 2026-02-14 19:19:16
Edit Download
795 B lrw-r--r-- 2026-02-14 19:19:16
Edit Download
1.85 KB lrw-r--r-- 2026-02-14 19:19:16
Edit Download
3.13 KB lrw-r--r-- 2026-02-14 19:19:16
Edit Download
533 B lrw-r--r-- 2026-02-14 19:19:16
Edit Download
1.62 KB lrw-r--r-- 2026-02-14 19:19:18
Edit Download
2.23 KB lrw-r--r-- 2026-02-14 19:19:18
Edit Download
920 B lrw-r--r-- 2026-02-14 19:19:18
Edit Download
4.09 KB lrw-r--r-- 2026-02-14 19:19:18
Edit Download
519 B lrw-r--r-- 2026-02-14 19:19:18
Edit Download
3.71 KB lrw-r--r-- 2026-02-14 19:19:18
Edit Download
2.33 KB lrw-r--r-- 2026-02-14 19:19:18
Edit Download
723 B lrw-r--r-- 2026-02-14 19:19:18
Edit Download
3.01 KB lrw-r--r-- 2026-02-14 19:19:18
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).