readEnvelopeFile

fun IOPlugin.readEnvelopeFile(path: Path, readNonEnvelopes: Boolean = false, formatPicker: IOPlugin.(Path) -> EnvelopeFormat? = IOPlugin::peekFileEnvelopeFormat): Envelope

Read and envelope from file if the file exists, return null if file does not exist.

If file is directory, then expect two files inside:

  • meta. for meta

  • data for data

If the file is envelope read it using EnvelopeFormatFactory.peekFormat functionality to infer format (if not overridden with formatPicker).

If the file is not an envelope and readNonEnvelopes is true, return an Envelope without meta, using file as binary.

Return null otherwise.