mwg API
    Preparing search index...

    Function loadPackage

    • Decodes a .mwp (digests, limits, paths) and reads its main document. Nothing in the package is executed, fetched or compiled: this is the whole install step.

      Parameters

      Returns Promise<LoadedPackage>

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

      const source = "[{ tag: 'package', id: 'marta', version: '1.0.0' }]";
      const bytes = await encodePackage([{ path: 'content.mwl', data: new TextEncoder().encode(source) }]);
      console.log((await loadPackage(bytes)).document.meta.id); // 'marta'