mwg API
    Preparing search index...

    Function encodePackage

    • Packs files into one .mwp. It refuses what decodePackage would refuse, so a package that was written can be read back under the same limits.

      Parameters

      Returns Promise<Uint8Array<ArrayBufferLike>>

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

      const text = new TextEncoder().encode('[]');
      const bytes = await encodePackage([{ path: 'content.mwl', data: text }]);
      console.log((await decodePackage(bytes)).main); // 'content.mwl'