Vanson Samuel
Vanson Samuel

Reputation: 2099

Is it possible for emacs to load a buffer from a Amazon S3 bucket?

Is it possible for emacs to load a buffer from a Amazon S3 bucket? If so has somebody already built something that can do this?

Upvotes: 5

Views: 975

Answers (3)

Roy
Roy

Reputation: 1015

If you would like to eval the file as well, you can do this:

(with-temp-buffer
  (shell-command "wget -q -O- URL_TO_FILE" (current-buffer))
  (eval-buffer))

Upvotes: 0

Trey Jackson
Trey Jackson

Reputation: 74480

Have you tried using curl?

In which case, you could do something like (untested):

(defun grab-s3-bucket (url)
  (interactive "sURL for Amazon s3 bucket: ")
  (shell-command (format "curl -O %s" url) (get-buffer-create url)))

M-x grab-s3-bucket URL

You could write the results back with something like:

(defun write-s3-bucket (url)
  (interactive "sURL for Amazon s3 bucket: ")
  (shell-command-on-region (format "curl %s -T " url)))

You could even get tricky and bind C-x C-s to the write-s3-bucket, using a buffer local variable to store the URL for the s3 bucket (that would get created upon the call to grab-s3-bucket).

Upvotes: 8

simao
simao

Reputation: 15569

You could use S3fs to mount a local filesystem mapped to a s3 drive and access the file normally with emacs.

Upvotes: 3

Related Questions