How to use the file-box.FileBox.fromBase64 function in file-box

To help you get started, we’ve selected a few file-box 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 wechaty / wechaty / src / puppet-padchat / padchat-manager.ts View on Github external
if (this.loginScanQrcode) {
      throw new Error('qrcode exist')
    }

    const result = await this.WXGetQRCode()
    if (!result || !result.qr_code) {
      log.verbose('PuppetPadchatManager', `emitLoginQrCode() result not found. Call WXInitialize() and try again ...`)

      await this.WXInitialize()

      // wait 1 second and try again
      await new Promise(r => setTimeout(r, 1000))
      return await this.emitLoginQrcode()
    }

    const fileBox = FileBox.fromBase64(result.qr_code, 'qrcode.jpg')
    const qrcodeDecoded = await fileBoxToQrcode(fileBox)

    this.loginScanQrcode = qrcodeDecoded
    this.loginScanStatus = WXCheckQRCodeStatus.WaitScan

    this.emit(
      'scan',
      this.loginScanQrcode,
      this.loginScanStatus,
    )
  }

file-box

Pack a File into Box for easy move/transfer between servers no matter of where it is.(local path, remote url, or cloud storage)

Apache-2.0
Latest version published 3 years ago

Package Health Score

45 / 100
Full package analysis