vinyl icon indicating copy to clipboard operation
vinyl copied to clipboard

Remote paths

Open bezoerb opened this issue 8 years ago • 4 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?

bezoerb avatar Feb 28 '17 15:02 bezoerb

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

yocontra avatar Feb 28 '17 16:02 yocontra

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.

phated avatar Feb 28 '17 20:02 phated

PR submitted: https://github.com/gulpjs/vinyl/pull/128

bezoerb avatar Mar 01 '17 06:03 bezoerb

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.

phated avatar Mar 06 '17 21:03 phated