fs provider in file publisher incompatible with vinyl 3 when contents is stream
If a virtual file is created with vinyl 3, and the contents of that file is a Stream, the fs provider in the file publisher fails to write when attempting to write that stream. This impacts the PDF extension from Antora Assembler (as of 1.0.0-alpha.9).
The reason this happens is because vinyl 3 creates an object (Cloneable) that filehandle.writeFile method does not recognize. Specifically, the object does not respond to the Symbol.asyncIterator method. So it's not perceived as a readable stream, which results in the following error:
The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received an instance of Cloneable
The error message does not account for all valid types for the data parameter. It also accepts any object that is iterable (which means it responds to either Symbol.iterator or Symbol.asyncIterator, the later of which an instance of Readable meets).
The solution is to coerce the stream by adding the Symbol.asyncIterator method from the Readable prototype if missing.