gulpjs / vinyl

Virtual file format.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`vinyl.toJSON` method?

Marak opened this issue · comments

commented

Hello.

Was wondering if there is any support for turning a vinyl File into a JSON object? I couldn't seem to find anything.

Obviously I can write a simple serialization method, but I was wondering if it exists anywhere else in the tool-chain. If not, would you want to add File.toJSON to core?

Good idea. I want to test this against a logging stream to make sure the custom display is used over toJSON

@Marak Still interested in this?

I'd like it to support this ideally: new File(otherFile.toJSON()) - might be overkill though to include history and other fields that might not be pretty to look at in a log.

Should we lose history here? Just stat/path/contents? LMK

@contra we can't actually do this due to streaming contents. It's the main reason I opened #133, which will be revisited in the next major (after gulp 4).

commented

I can't remember the specifics, but it seemed to be having been working fine for my use-case.

I needed to serialize the object in order to inspect its properties, not inspect it's binary contents or stream data.