cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ian Clelland <iclell...@chromium.org>
Subject Re: FileTransfer download null-target
Date Thu, 05 Dec 2013 15:44:00 GMT
On Thu, Dec 5, 2013 at 9:56 AM, Axel Nennker <ignisvulpis@gmail.com> wrote:

> Exposing a mkstemp like function would be another issue.
> Where would you put it? The W3C File API does not have this.
> http://www.w3.org/TR/FileAPI/


I just mean that it has similar semantics to mkstemp -- without the
template, I suppose: you are guaranteed to get back a file in a temporary
location, with a name that doesn't collide with any other files that happen
to be there. (Hopefully, with no race conditions, in the event that you
have two outstanding requests at the same time). Not that we literally
implement File.mkstemp().

Ian


>
>
> I think that implementing "target==null" for FileTransfer.download on
> Android is super simple.
> I guess that it is simple an other platforms too.
>
> I started this for Android
>
> https://github.com/AxelNennker/cordova-plugin-file-transfer/blob/master/src/android/FileTransfer.java
> (not tested yet. Will do that later)
>
> -Axel
>
>
>
> 2013/12/5 Ian Clelland <iclelland@chromium.org>
>
> > This could be really useful -- like a mkstemp() function -- to avoid any
> > possibility of name collision, and save the user from the hassle of
> > managing names that they don't really care about anyway.
> >
> > I wonder how many developers have had to independently implement some
> kind
> > of "generate random filename; check for existing file; repeat if true"
> > procedure just to cache files.
> >
> >
> >
> >
> > On Thu, Dec 5, 2013 at 4:57 AM, <Axel.Nennker@telekom.de> wrote:
> >
> > > Hi,
> > >
> > > I think a developer who uses FileTransfer's download does not always
> care
> > > to which file the remote content is downloaded to.
> > >
> > > I suggest to allow a target parameter of "null" to denote some
> temporary
> > > file.
> > >
> > >
> >
> https://github.com/apache/cordova-plugin-file-transfer/blob/master/src/android/FileTransfer.java#L180
> > >
> > > In the success callback the developer gets a FileEntry and can do with
> it
> > > whatever is needed e.g. delete it after use.
> > >
> > > Do you think this is usefull for cordova user?
> > >
> > > - Axel
> > >
> > >
> > >
> >
> https://cordova.apache.org/docs/en/2.5.0/cordova_file_file.md.html#FileTransfer_download
> > >
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message