gulpjs / vinyl

Virtual file format.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Make vinyl files more web File like

jimmywarting opened this issue · comments

Describe your idea for a new feature

I propose making the virtual files more web- Blob/File IDL like by introducing: stream(), text(), arrayBuffer(), slice(), size, name and type

Explain the problem your idea is trying to solve

I think ppl would feel more at home if virtual files where more like web Blob/File (in fact they are introduced into NodeJS at this point globally)
if they behaved more like Blob/Files then it would also be possible to use them with eg fetch and FormData and you would even be able to concat files together using new Blob([ virualFileA, virualFileB ]) - that's if you are using fetch-blob

If this feature could exist outside of gulp (like as a plugin or a module), would you be interested in helping to create and maintain it?

Hmm, it could exist outside of gulp, but then i would have to add new prototype methods to vinyl files. or extend it...

This is a pretty good idea. I'll slate it to discuss with the team to see if we can reconcile the idea with the future plans for Vinyl.

just by making vinyl files more like blobs would mean that lots of other packages that base it's code on Blob would actually start to work with vinyl files too.
There are lots of other packages like zip/pdf/excl readers that operates solo on blob IDL api's
so having this blob methods on vinyl files would be really good 👍

web stream would be tuff doe... it would kind of have to be conditionally supported based on if ReadableStream is supported in the current env. wouldn't mind if .stream() throwed a error telling me that web ReadableStream isn't supported.