Skip to content

Support Encode & Decode QR Code functions from file-box@0.10 #1907

@huan

Description

@huan

In order to deal with the QR Code image file convenience, we start supporting the following two new methods in the FileBox v0.10:

FileBox.fromQRCode(qrCodeValue: string)

Get a FileBox instance that represent a QR Code value.

const fileBox = FileBox.fromQRCode('https://github.com')
fileBox.toFile('qrcode.png')

fileBox.toQRCode(): Promise<string>

Decode the QR Code value from the file.

const fileBox = FileBox.fromFile('qrcode.jpg')
const qrCodeValue = await fileBox.toQRCode()
console.log(`QR Code decoded value is: "${qrCodeValue}"`)
// Output: QR Code decoded value is: "https://github.com"

I hope you will enjoy it!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions