gulpjs / vinyl

Virtual file format.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Remote paths

bezoerb opened this issue · comments

First I would like to thank you for your work on this module.
Version 2 brought some internal changes which prevent the use of vinyl for remote objects.
Prior to v2 it was possible to store an url as path. The use of path.normalize introduced in v2 breaks this "feature" ;)
Is this the intended behaviour or would you accept a PR to "fix" this?

Yeah, that was a mistake! Vinyl should absolutely support any kind of URL/path - A PR w/ some tests to prevent this in the future would be great

This is a hard problem to solve because we need to normalize filesystem paths. There needs to be a module created that determines if a path is fs or remote.

PR submitted: #128

Copying my comment from #128 PR:

I actually believe this problem can and should be solved by my idea of an Enhanced Stat Object (#105). Usage would look something like:

var file = new Vinyl({
  path: 'http://google.com',
  stat: {
    isRemote: true
  }
})

The isRemote flag in the Enhanced Stat Object would indicate that a Vinyl resource is being constructed with a remote path and would disable normalization (or do URL normalization). Also, Enhanced Stat Objects would allow for property changes and track history, a non-remote file could be converted to a remote file and users would know where it happened in a pipeline.