How to use the restructure.DecodeStream function in restructure

To help you get started, we’ve selected a few restructure examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wowserhq / blizzardry / src / spec / wmo / index-spec.js View on Github external
const dummy = (function () {
    const data = fs.readFileSync(path.join(fixtures, 'trolltent.wmo'));
    const stream = new r.DecodeStream(data);
    return WMO.decode(stream);
  }());
github wowserhq / blizzardry / spec / dbc / index-spec.js View on Github external
var stream = function stream() {
    var data = fs.readFileSync(fixtures + 'Sample.dbc');
    return new r.DecodeStream(data);
  };
github foliojs / fontkit / src / base.js View on Github external
fontkit.create = function(buffer, postscriptName) {
  for (let i = 0; i < formats.length; i++) {
    let format = formats[i];
    if (format.probe(buffer)) {
      let font = new format(new r.DecodeStream(buffer));
      if (postscriptName) {
        return font.getFont(postscriptName);
      }

      return font;
    }
  }

  throw new Error('Unknown font format');
};
github wowserhq / blizzardry / src / spec / m2 / skin-spec.js View on Github external
const dummy = (function () {
    const data = fs.readFileSync(path.join(fixtures, 'Rabbit00.skin'));
    const stream = new r.DecodeStream(data);
    return Skin.decode(stream);
  }());
github wowserhq / blizzardry / spec / adt / index-spec.js View on Github external
var dummy = (function () {
    var data = fs.readFileSync(fixtures + 'Azeroth_38_46.adt');
    var stream = new r.DecodeStream(data);
    return ADT.decode(stream);
  })();
github foliojs / fontkit / src / TrueTypeCollection.js View on Github external
get fonts() {
    let fonts = [];
    for (let offset of this.header.offsets) {
      let stream = new r.DecodeStream(this.stream.buffer);
      stream.pos = offset;
      fonts.push(new TTFFont(stream));
    }

    return fonts;
  }
}
github wowserhq / blizzardry / src / spec / dbc / index-spec.js View on Github external
const stream = function () {
    const data = fs.readFileSync(path.join(fixtures, 'Sample.dbc'));
    return new r.DecodeStream(data);
  };
github foliojs / fontkit / src / WOFF2Font.js View on Github external
this.stream.pos = this._dataPos;
      let buffer = this.stream.readBuffer(this.directory.totalCompressedSize);

      let decompressedSize = 0;
      for (let tag in this.directory.tables) {
        let entry = this.directory.tables[tag];
        entry.offset = decompressedSize;
        decompressedSize += (entry.transformLength != null) ? entry.transformLength : entry.length;
      }

      let decompressed = brotli(buffer, decompressedSize);
      if (!decompressed) {
        throw new Error('Error decoding compressed data in WOFF2');
      }

      this.stream = new r.DecodeStream(new Buffer(decompressed));
      this._decompressed = true;
    }
  }
github wowserhq / blizzardry / src / spec / m2 / index-spec.js View on Github external
const dummy = (function () {
    const data = fs.readFileSync(path.join(fixtures, 'Rabbit.m2'));
    const stream = new r.DecodeStream(data);
    return M2.decode(stream);
  }());
github wowserhq / blizzardry / spec / m2 / skin-spec.js View on Github external
var dummy = (function () {
    var data = fs.readFileSync(fixtures + 'Rabbit00.skin');
    var stream = new r.DecodeStream(data);
    return Skin.decode(stream);
  })();