vinyl icon indicating copy to clipboard operation
vinyl copied to clipboard

`vinyl.toJSON` method?

Open Marak opened this issue 9 years ago • 4 comments

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?

Marak avatar Apr 20 '16 08:04 Marak

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

phated avatar Apr 20 '16 18:04 phated

@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

yocontra avatar Aug 04 '17 20:08 yocontra

@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).

phated avatar Aug 04 '17 20:08 phated

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.

Marak avatar Aug 04 '17 20:08 Marak