-
-
Save mgoerlich-dev/9725642 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. you should install LWP::Simple and Fuse:Simple - use cpan or cpanm | |
2. you should configure the local fuse install to run as root or as common user | |
3. don't forget 'fusermount -u <mountpoint>' after finish the script | |
to test | |
$ chmod +x cats.pl | |
$ mkdir catfs | |
$ ./cats.pl catfs | |
# in other terminal | |
$ ls catfs | |
cat.jpg | |
$ gimp catfs/cat.jpg # will open a different kitten pic each time | |
# after finish the script | |
$ fusermount -u catfs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use LWP::Simple; | |
use Fuse::Simple qw(main); | |
my $mountpoint = $ARGV[0]; | |
die "usage: $0 <directory>\n" if ! defined $mountpoint || ! -d $mountpoint; | |
main( | |
mountpoint => $mountpoint, | |
"/" => { | |
'cat.jpg' => sub { | |
get('http://thecatapi.com/api/images/get?format=src&type=jpg'); | |
}, | |
}, | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment