[web-nfc] Provide a way to get the NDEFMessage and NDEFRecord size before writing (#593)

Snapstromegon has just created a new issue for https://github.com/w3c/web-nfc:

== Provide a way to get the NDEFMessage and NDEFRecord size before writing ==
_I did not find something like this in the spec or in Chrome's current canary (86.0.4196.0) implementation._

## Problem Abstract

I'm trying to write some data to NFC Tags, but I want to know how large the NDEFMessage/Record is before I'm writing it (to predict fail/success cases).

## Usecase

My usecase during origin trial was, that I write some optional history data into the record and I know exactly how large the size of my card is and I want to include as much of the history as possible.

## Problem / Existing Workarounds

Currently I'd need to start at some point and do a lot of trial and error which results in many read/writes or I implement the calculation myself which might result in errors.

## Proposed solution

Adding a "size" attribute (or something similar) to NDEFMessage and NDEFRecord would make this usecase way easier.

Please view or discuss this issue at https://github.com/w3c/web-nfc/issues/593 using your GitHub account

Received on Friday, 10 July 2020 16:39:36 UTC