Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Possible to symlink a file to a web url?

Tags:

linux

We currently have a challenge where the ideal solution would be to symlink a file to a web URL...

image.jpg -> http://www.host.com/images/image.jpg

Is this possible?

like image 932
Jeffrey L. Roberts Avatar asked Jan 31 '13 19:01

Jeffrey L. Roberts


3 Answers

Maybe a named pipe that you feed with a wget for the file?

Edit - Not wget. You can work with linx -dump. So -

mkfifo reddit
links -dump reddit.com > reddit
cat reddit
like image 66
Slartibartfast Avatar answered Oct 08 '22 01:10

Slartibartfast


There are several nice and interesting solutions here. I especially like @ArjunShankar's fuse solution. In the spirit of keeping it simple though, perhaps a file in /etc/cron.daily with

#!/bin/sh
cd /your/dir && wget -N http://www.host.com/images/image.jpg

would be a lot simpler and Good Enough(TM)?

like image 32
that other guy Avatar answered Oct 08 '22 00:10

that other guy


On mac I successfully used this great tool by maxogden, which also using FUSE:
https://github.com/maxogden/mount-url

brew install osxfuse
npm install -g mount-url

Then

mount-url "https://url-to-10-gb-video-file-on-some-external-cloud-storage/video.mp4?xxx=yyy"

This would create a symlink for the file named video.mp4 in the current directory.
Not too fast access speed, but works.

like image 33
Pavel Alexeev Avatar answered Oct 08 '22 01:10

Pavel Alexeev