How to use the qrloop.dataToFrames function in qrloop

To help you get started, we’ve selected a few qrloop 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 LedgerHQ / ledger-live-common / cli / src / commands.js View on Github external
mergeMap(accounts => {
          const data = encode({
            accounts,
            settings: {
              pairExchanges: {},
              currenciesSettings: {}
            },
            exporterName: "ledger-live-cli",
            exporterVersion: "0.0.0"
          });
          const frames = dataToFrames(data, 80, 4);

          if (opts.out) {
            return of(Buffer.from(JSON.stringify(frames)).toString("base64"));
          } else {
            const qrObservables = frames.map(str =>
              asQR(str).pipe(shareReplay())
            );
            return interval(300).pipe(
              mergeMap(i => qrObservables[i % qrObservables.length])
            );
          }
        }),
        tap(() => console.clear()) // eslint-disable-line no-console

qrloop

Envelop big blob of data into frames that can be displayed in series of QR Codes

MIT
Latest version published 2 years ago

Package Health Score

45 / 100
Full package analysis