Re: File Save As

On Sat, Jan 5, 2013 at 7:35 AM, Florian Bösch <pyalot@gmail.com> wrote:

> #1 This is a two-step UX where first the content has to be produced and
> then
> the dialog can be shown, it's somewhat counter intuitive.


Note that for saving dynamically-generated content to disk, you probably
want FileSaver rather than @download.  With @download you have to put the
whole file in a data: URL, which doesn't scale to larger files--you
wouldn't want to put a 100 MB video file in a data: URL, and you don't
always want to constantly update the contents of a link (which may be
expensive).

#2 Left clicking the link auto-saves to the downloads folder with the
> selected
> file name (no way to choose a location).



> #3 Right click Save As is
> even a bit more counter intuitive and the filename for the blob url
> content is not derived from the a@download attribute.
>

These are issues with the browser you're using, not the spec.  I don't
think you ever said which browser you're using, but you should file a bug
on it if you think the behavior is wrong.  (Chrome has a tendency to save
without asking the user for a location or filename, so #2 may be by design
if that's the browser you're in.)

- There is no way to trigger a native "Save As" dialog
>

In principle, calling .click() on the anchor should do this, exactly the
same as you can do with an <input type=file>.  I don't know if this is
actually implemented or allowed by browsers, and if it is I assume it would
only be allowed on user interaction.

 Neither the File API nor the FileSaver API (somewhat counter

> intuitively) define any behavior partaining to "Save As" or "Save". As
> far as I can tell there is no standard for this. So far the workaround
> seems to be to include a flash file and trigger the save-as via the
> flash bridge, which I'm sure can't be the ideal situation for the
> webapps WG.
>

FileSaver corresponds to "save as": when you create a FileSaver, the
browser should ask the user where to save the blob.  (There doesn't seem to
be a way to suggest a filename, though, which seems like an important thing
to be missing.  Maybe that's waiting for a File constructor, which would
allow attaching a filename to the blob?  That seems a bit awkward, and it's
not in the spec yet, so I'm not sure.)

No feature on the platform that I know of allows writing over a file the
user already saved without prompting.  I'm guessing the security
considerations here are difficult.

-- 
Glenn Maynard

Received on Saturday, 5 January 2013 18:43:19 UTC