Best way to download large files direct to disk?

Hi,
I am writing a process that will download a file (in the
background, no GUI interaction) and will save it onto the users
drive. Once it is saved to disk they will be notified.
I don't want to use FileReference as that prompts the user, I
also don't want to just use UrlStream direct into a ByteArray
because the files can be quite big and I don't want to hog memory.
What would you recommend I do? Is the only option to simply
do an urlstream.readBytes() into a smaller temporary ByteArray and
then immediately write those bytes to disk, rather than appending
to an overall larger byte array that only gets written once the
entire file is saved?

I think it might be your lucky day, I think I just saw the
article you need.....
http://jarinheit.com/2008/06/19/downloading-large-files-in-adobe-air-with-flex/
....you didn't say what you wanted to do it in and well Im
trying to learn JS and all this so I converted it....
quote:
<html>
<head>
<script src="AIRAliases.js" />
<script>
var urlString = "
http://www.adobe.com/lib/com.adobe/template/gnav/adobe-hq.png";
var urlReq = new air.URLRequest(urlString);
var urlStream = new air.URLStream();
var fileStream = new air.FileStream();
urlStream.addEventListener(air.Event.COMPLETE, loaded);
urlStream.addEventListener(air.ProgressEvent.PROGRESS,
writeFile);
var file =
air.File.desktopDirectory.resolvePath("testing.png");
fileStream.openAsync(file, air.FileMode.WRITE);
urlStream.load(urlReq);
function writeFile(event) {
// only write every 50k or so downloaded
if (urlStream.bytesAvailable > 51200) {
// Read the buffer into a ByteArray and write it to disk
var data = new air.ByteArray();
urlStream.readBytes(data, 0, urlStream.bytesAvailable);
fileStream.writeBytes(data, 0, data.length);
function loaded(event) {
// Write any remaining data to the file before closing it
var data = new air.ByteArray();
urlStream.readBytes(data, 0, urlStream.bytesAvailable);
fileStream.writeBytes(data, 0, data.length);
fileStream.close();
</script>
</head>
<body>
</body>
</html>
...and it downloads it in the background.
Hope it helps.

Similar Messages

  • Best way to transfer large files over the Internet?

    What is the best way to transfer files that are too large to send by e-mail over the internet, preferably ways that are free or very cheap and are easiest for sender and receiver to work with?
    I assume one way is by ftp, but would that necessarily mean buying space on a server somewhere that both I and my recipients can get to? or is there a way to avoid this cost?

    you can use a cloud storage like Mobileme (not free) or DropBox (free up to 2GB).
    you can also use direct file sharing over internet. no extra software or 3rd party services required. that's what I use to move files between my home and work computers.

  • Best Way to Copy Large Files

    In copying files to a USB memory stick, is there a particular file size limit above which simple drag and drop using the Finder does not work consistently? In general can we assume that if it appears to copy OK, then the files are in good shape? For example, if I'm copying a Documents folder with 5 GB of data onto an 8 GB USB stick would it be appropriate to use drag and drop? What are the alternative ways to copy large blocks of data? Is there a way to use Disk Utility for this?
    I should mention one of the reasons I'm asking. I've occasionally noticed large copying procedures sometimes cause the Finder to "hang."
    I do have SuperDuper which I use to clone my internal HD to a peripheral HD on a regular basis. Would that software provide a way to copy single files or folders containing lots of files to my USB memory stick?
    Thanks,
    Steve M.
    Message was edited by: Steve M.

    Drag and drop is fine. There's really no good reason to do it a different way.
    The only file limit is if the USB stick is formatted FAT32. Then 4GB minus 1 byte is the largest file size it can hold. If you format the stick as Mac OS Extended (HFS+), there's no limit to the file size, just the capacity of the drive itself.
    If you need to share between Mac and Windows, then formatting the stick as ExFAT is best. The only catch is that versions of OS X earlier than Snow Leopard will not be able to read the drive. Windows XP, Vista and Win 7 can read ExFAT. There is also essentially no file size limit with ExFAT.
    As far as the hanging, that may be the OS stalling on a file larger than 4 GB if the USB stick is formatted as FAT32.

  • Best way to handle large files in FCE HD and iDVD.

    Hi everyone,
    I have just finished working on a holiday movie that my octagenarian parents took. They presented me with about 100 minutes of raw footage that I have managed to edit down to 64 minutes. They have viewed the final version that I recorded back to tape for them. They now want to know if I can put it onto a DVD for them as well. Problem is the FCE HD file is 13Gb.
    So here is my question.
    What is the best way to handle this problem?
    I have spoken to a friend of mine who is a professional editor. She said reduce the movie duration down to about 15mins because it's probably too long and boring. (rather hurtful really) Anyway that is out of the question as far as my oldies are concerned.
    I have seen info on Toast 8 that mentions a "Fit to DVD" process that purports to "squash" 9Gb of movie to a 4.7Gb disk. I can't find if it will also put 13Gb onto a dual layer 8.5Gb disk.
    Do I have to split the movie into two parts and make two dual layer DVD's? If so I have to ask - How come "Titanic", 3hrs+ fits on one disk??
    Have I asked too many questions?

    Take a deep breath. Relax. All is fine.
    iDVD does not look at the size of your video file, it looks at the length. iDVD can accomodate up to 2 hours of movie
    iDVD gives you different options depending on the length of your movie. Although I won't agree with your friend about reducing the length of your movie to 15 minutes, if you could trim out a few minutes to get it under an hour that setting in iDVD (Best Performance though the new version may have renamed it) gives you the best quality. Still, any iDVD setting will give you good quality even at 64 minutes
    In FCE export as Quicktime Movie NOT any flavour of Quicktime Conversion. Select chapter markers if you have them. If everything is on one system unchecked the Make Movie Self Contained button. Drop the QT file into iDVD

  • What is the best way to download audio files?

    I am building a website for a church.  How do I put the weekly audio sermons on the site, so that the files don't take forever to download?
    I had a link with quicktime, but someone said they didn't have that plug-in, so I have embedded the files.
    ...what is the most popular and fast way for people to hear the sermons?
    I have split up the pages.
    I was hoping for one like, https://crosspointelpaso.ctsmemberconnect.net/sermon-ctrl.do?view=0&grpId=26073
    This is where I am now...http://www.estevanfaithlutheran.com/listentosermonsonline.html
    Thank you.
    Em

    The site that you referenced is using mp3 for the sermon audios...  if you look at the code for one of the links it is this:
    <a href="https://f1.ctsmemberconnect.net/garoupdb/O-0000000937/G-0000026073/audio/Sep 21 2008.mp3" title="" target="_blank">What Is God Looking At?</a>
    It then depends on what the client machine uses to run mp3s as to how they open, automaticallly or the viewer is asked whether they want to open the file using their mp3 player.  Probably more widespread than using quicktime.

  • Best way to copy large files to a desktop computer

    I have a MacBook Air with a large (16GB) iPhoto library that I want to copy to 2 desktop iMacs. The desktops are on an ethernet link with a hub, and I have an Airport network as well. Copy time via Airport shows as 20 hours. I have used the USB-to-ethernet connector to tie the MBA into the ethernet network but am still getting a copy time of 10 hours. Is there a faster way to link these machines? Thanks.

    I have found the fastest way is to copy the whole shebang on an external hard disk with a USB 2 connection. I also have tons of photographs on mine and make that step in between e.g. first copy on an external HD and then on to the larger Mac
    what you describe is terribly slow. I agree

  • What's the best way to transfer large files to a fellow Mac user?

    … ftp, file sharing, dropbox…?

    Is this a one-time transfer?
    If so, what is your email file size limit?
    Depending on the limit, try Compressing the file.  If that doesn't work, try splitting the file into smaller chunks with Tar.
    In Terminal (assumes file is on Desktop, if not, just change cd)
    Note: don't use full path in filename unless you want it stored in the Tar
    This will break the file into 10MG chunks (-L10000):
      cd Desktop
      /usr/bin/gnutar -L10000 -cMv --file=tar_archive.{tar,tar-{2..25}} [FileToTar]
         to Extract on the receivers end:
             /usr/bin/gnutar -xMv --file=tar_archive.{tar,tar-{2..25}}

  • What is best way dealing with large tiff file in OSX Lion?

    I'm working with large tiff  file (engineering drawing), but preview couldnt handle (unresponsive) this situation.
    What is best way dealing with large tiff file in OSX Lion? (Viewing only or simple editing)
    Thx,
    54n9471

    Use an iPad and this app http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=400600005&mt=8

  • What's the best way to removed unwanted files?

    I have an iMac G4 running OS X 10.4.11 with 1GB of DDR SDRAM. I'm wondering what's the best way to remove unwanted files from the RAM, if it's even possible. There are apps and other files I no longer need. If I can dump the unused files will it help the computer run a little faster? Can I eliminate the unwanted files some how by myself or do I need a program that does it? Thanks

    bad dad wrote:
    I have an iMac G4 running OS X 10.4.11 with 1GB of DDR SDRAM. I'm wondering what's the best way to remove unwanted files from the RAM, if it's even possible. There are apps and other files I no longer need. If I can dump the unused files will it help the computer run a little faster? Can I eliminate the unwanted files some how by myself or do I need a program that does it? Thanks
    Applications are stored perminately on the harddrive [ Macintosh HD ]. When applications are running that is when they appear in a window, they take up RAM. You see your running applications by using activity monitor:
    Macintosh-HD -> Applications -> Utilities -> Activity Monitor
    Application when they are not running, they do not take up RAM.  You will not see any performance improvement when you delete an application from your Harddrive.  [ unless you have filled up your harddrive ]
    Best to have greater than 2gig of free space on your Harddrive.  Many posters to these forums state that you need much more free space: 5 gig to 10 gig or 10 percent of you hd size.
    Most applications do not take up much space on the Harddrive.  I copy my unused application to a folder named additional applications.
    (0)
    Be careful when deleting files. A lot of people have trashed their system when deleting things. Place things in trash. Reboot & run your applications. Empty trash.
    Go after large files that you have created & know what they are.  Do not delete small files that are in a folder you do not know what the folder is for. Anything that is less than a megabyte is a small file these days.
    (1)
    Run
    OmniDiskSweeper
    "The simple, fast way to save disk space"
    OmniDiskSweeper is now free!
    http://www.omnigroup.com/applications/omnidisksweeper/download/
    This will give you a list of files and folders sorted by size. Go after things you know that are big.
    (2)
    This will save you a gig of space.
    Monolingual is a program for removing unnecessary language resources from Mac OS X,in order to reclaim several hundred megabytes of disk space. It requires at least Mac OS X 10.3.9 (Panther) and also works on Mac OS X 10.4 (Tiger). It worked for me on 10.4
    http://monolingual.sourceforge.net/
    A detailed write-up on how to use Monolingual:
    http://www.jklstudios.com/misc/monolingual.html
    (3)
    These pages have some hints on freeing up space:
    http://thexlab.com/faqs/freeingspace.html
    http://www.macmaps.com/diskfull.html
    (4)
    Buy an external firewire harddrive.
    (5)
    Buy a flash card.

  • Can I download large files a bit at a time

    I'm on dialup and I'm wondering if it is possible to download large files, such as security updates, in small bits like you can do from a P2P network.
    Can I adjust a preference, download a utility, buy some additional software?
    Thanks in advance for any suggestions.
    G5 iSight   Mac OS X (10.4.2)  

    Thanks Niel for the link. I downloaded that program, and then, knowing what to look for, located a few others as well.
    I'm sure they all will allow me to download large files, but how do I get these programs to press the button that says "Download". I go to the page that has the "Download" button, copy the web address for that page, paste it into the program, tell it to download, but of course all it does is copy the page.
    I know there must be an easy way to do it, but after a few hours of trying I can't fathom it.
    How do you find the web address of the actual file?

  • Best way to handle text files in OD10g

    We have a requirement to store reports in text format into a database field, to be able to view the reports, and to print them if desired using Forms 10g. What is the best way to handle this?
    - define the field in the database as clob or blob?
    - if CLOB is the choice, what tools to use to upload CLOBs to the database (since webutil transfer is for blob only)?
    - in Forms 10g, can one use the Forms data type LONG for CLOB?
    - can you do Forms search on clob and blob fields?
    - how can reports that are stored in fields be viewed without first downloading to the client workstation?
    - in Forms 10g, what is the best way to view text files residing in local PCs: "host notepad myFile"?
    Thanks much for your reply!
    gk

    Take a deep breath. Relax. All is fine.
    iDVD does not look at the size of your video file, it looks at the length. iDVD can accomodate up to 2 hours of movie
    iDVD gives you different options depending on the length of your movie. Although I won't agree with your friend about reducing the length of your movie to 15 minutes, if you could trim out a few minutes to get it under an hour that setting in iDVD (Best Performance though the new version may have renamed it) gives you the best quality. Still, any iDVD setting will give you good quality even at 64 minutes
    In FCE export as Quicktime Movie NOT any flavour of Quicktime Conversion. Select chapter markers if you have them. If everything is on one system unchecked the Make Movie Self Contained button. Drop the QT file into iDVD

  • What is the Best way to move large mailboxes between datacenters?

    What is the Best way to move large mailboxes between datacenters?

    Hi, 
     Are you asking with regards to on-premises Exchange? With Microsoft Online SaaS services (aka Exchange Online) there is no control and no need to control which data center a mailbox resides in.
     With regard to on-premises Exchange, you have two choices: you can move it over the WAN in which case you would either do a native mailbox move (assuming you have Exchange 2010 or later you can suspend the move after the copy so you can control the
    time of the cutover) or create a database copy in the second data center and once the database copies have synchronized change the active copy.
    The other choice is to move is out of band which would usually involve an offline seed of the database (you could conceivably move via PST file but that would disrupt access to the mailbox and is not really the 'best way').
    In general, Exchange on-premises questions are best asked on the Exchange forum: http://social.technet.microsoft.com/Forums/office/en-US/home?category=exchangeserver
    Thanks,
    Guy 

  • Best way to stream MP3 files with ColdFusion

    I was looking for a kind of a built in player look in that
    all the user has to do is click and it will start playing within
    the browser. Some of the files are even 48MB long so if I can
    reduce that too that would be good. client goes on conferences and
    plan to record more conferences and we would like to host them on
    the site.
    Any Help?

    Making pod casts:
    http://www.podcastingnews.com/articles/How-to-Podcast.html
    http://www.windowsdevcenter.com/pub/a/windows/2005/04/05/create_podcasts_with_pc.html
    Flash players for MP3s:
    http://wimpyplayer.com
    Jukebox from
    http://swishzone.com
    --Nancy O.
    "Brandon" <[email protected]> wrote
    in message
    news:et99hk$svu$[email protected]..
    > I'm looking for recommendations about the best way to
    publish mp3 files.
    I
    > have a client that is a church that wants their staff to
    be able to upload
    > mp3 files on a weekly basis from a web client and have
    those files
    > automatically be included in a podcast feed as well as
    have a "play"
    option
    > and a "download" option. I know how to setup the front
    end . . . any
    > suggestions on the best way to implement this on the
    back end (such as
    > extensions or services)?
    >
    > --
    > Brandon
    >
    http://www.presentationsdirect.com
    >

  • Best way to download mp3?

    What's the best way to download an mp3 from a Web page that's not part of a podcast subscription using iTunes 7.0.2?
    I can download from my Web browser and then import into iTunes, but that's two steps.
    I can select Import or Add File to Library and enter the URL, but the file ends up in a Windows temp folder, and I'm unable to edit the Info. (It's greyed out, and typically I want to change the genere.)
    I'm sure I'm missing something obvious, but certainly there must be a one-step way of doing this?

    If you save the quicktime audio as a self cotained .mov format, it can be imported into itunes. It can then be converted to an mp3 by using the "covert selection to mp3" under the advanced menu if needed.
    Hope this helps
    iMac G5   Mac OS X (10.4.8)   1 Gb RAM
    iMac G5   Mac OS X (10.4.1)  
    iMac G5   Mac OS X (10.4.8)  

  • Best Way to Publish mp3 Files?

    I'm looking for recommendations about the best way to publish
    mp3 files. I
    have a client that is a church that wants their staff to be
    able to upload
    mp3 files on a weekly basis from a web client and have those
    files
    automatically be included in a podcast feed as well as have a
    "play" option
    and a "download" option. I know how to setup the front end .
    . . any
    suggestions on the best way to implement this on the back end
    (such as
    extensions or services)?
    Brandon
    http://www.presentationsdirect.com

    Making pod casts:
    http://www.podcastingnews.com/articles/How-to-Podcast.html
    http://www.windowsdevcenter.com/pub/a/windows/2005/04/05/create_podcasts_with_pc.html
    Flash players for MP3s:
    http://wimpyplayer.com
    Jukebox from
    http://swishzone.com
    --Nancy O.
    "Brandon" <[email protected]> wrote
    in message
    news:et99hk$svu$[email protected]..
    > I'm looking for recommendations about the best way to
    publish mp3 files.
    I
    > have a client that is a church that wants their staff to
    be able to upload
    > mp3 files on a weekly basis from a web client and have
    those files
    > automatically be included in a podcast feed as well as
    have a "play"
    option
    > and a "download" option. I know how to setup the front
    end . . . any
    > suggestions on the best way to implement this on the
    back end (such as
    > extensions or services)?
    >
    > --
    > Brandon
    >
    http://www.presentationsdirect.com
    >

Maybe you are looking for

  • Photoshop Elements 8 does not open any files

    Dear Community, today I booted my adobe photoshop elements 8.0 to do some picture editing. But when I try to open a file nothing happens. And I mean nothing. Photoshop just keeps on running but it doesn nothing with the command I gave it. It doesn't

  • Bridge not recognizing RAW files

    How do get bridge in CS4 to recognize raw files from my Canon 5D Mk3?

  • Users logon issue

    Hello ALL, In pec 4 to 5 users used to logon through same user id previously but now they are not able to logon together from that user id plz help me out in this in brief. Regards

  • Newbie having trouble with opt/rep regions

    Hi everyone. I'm migrating my site from simple, square html to nice, elegant css. I've done most of the work, but I'm having some trouble with templates. Here's an example of how a page created with a template will (hopefully) look: http://www.technf

  • Create one agent and save it, it will generate error message.

    Hi experts, In OBIEE 11g ,when I create one agent for sending the emial to group and click saved button, it will generate the following message: [nQSError: 76015] The active Oracle BI Scheduler instance in the cluster could not be determined. Are you