mwg API
    Preparing search index...

    Function decodePackage

    • Reads a .mwp. Every entry is inflated within its declared size and matched to its SHA-256 before anything is returned; any problem throws a PackageError subclass and no partial content escapes.

      Parameters

      Returns Promise<DecodedPackage>

      import { decodePackage, encodePackage } from '@datamoc/mwg/mwl';

      const bytes = await encodePackage([{ path: 'content.mwl', data: new TextEncoder().encode('[]') }]);
      const decoded = await decodePackage(bytes, { maxEntries: 8 });
      console.log(decoded.files.map((file) => file.path)); // ['content.mwl']