load

Load records or payloads from disk.

Synopsis

ndeftool load [OPTIONS] PATH
ndeftool l [OPTIONS] PATH

Description

The load command reads records or payloads from disk files or standard input. The files for reading are determined by the pattern specified by PATH, which in the simplest form is an existing file name. Other forms may include *, ? and character ranges expressed by []. A single - may be used to read from standard input. Note that patterns containg wildcards may need to be escaped to avoid shell expansion.

The default mode of operation is to load files containing NDEF records. In --pack mode the files are loaded into the payload of NDEF records with record type (NDEF Record TNF and TYPE) set to the mimetype discovered from the payload and record name (NDEF Record ID) set to the filename.

Options

-p, --pack

Pack files as payload into mimetype records.

--help

Show this message and exit.

Examples

Pack text from standard input and pack as record.

$ echo -n "Hello World" | ndeftool load --pack - print
NDEF Record TYPE 'text/plain' ID '<stdin>' PAYLOAD 11 byte '48656c6c6f20576f726c' ... 1 more

Read text from file and pack as record.

$ echo -n "Hello World" > /tmp/hello && ndeftool load --pack /tmp/hello print
NDEF Record TYPE 'text/plain' ID '/tmp/hello' PAYLOAD 11 byte '48656c6c6f20576f726c' ... 1 more

Read with path containing wildcard characters.

$ ndeftool load --pack 'i?d*.rst' print
NDEF Record TYPE 'text/plain' ID 'index.rst' PAYLOAD 627 byte '2e2e202d2a2d206d6f64' ... 617 more

Read and pack multiple files.

$ ndeftool load --pack '../se?up.*' print
NDEF Record TYPE 'text/plain' ID '../setup.cfg' PAYLOAD 141 byte '5b746f6f6c3a70797465' ... 131 more
NDEF Record TYPE 'text/x-python' ID '../setup.py' PAYLOAD 2563 byte '23212f7573722f62696e' ... 2553 more