Allows for file streams to be passed as the file option for pictures. #183
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Before this,
options.file
had to be aString
,Buffer
, orURL
(though only a URL on the local filesystem) as it was passed directly tocreateReadStream
. I added in a duck typing to only create a read stream if it is not already a stream.This feature allows for downloading files from a remote URL and passing the readable stream to the picture widget instead of actually downloading a file to some tmpfs location. The only other way I could think of doing this without downloading the file to the filesystem was to convert the fetched file to base64 and use the
options.base64
option picture supports. But this is much more convenient and more efficient to boot.