Re: Identifying complete size of file when transfer is in progress
Re: Identifying complete size of file when transfer is in progress
- Subject: Re: Identifying complete size of file when transfer is in progress
- From: Jens Alfke <email@hidden>
- Date: Fri, 15 Nov 2013 16:08:53 -0800
On Nov 15, 2013, at 1:28 PM, Devarshi Kulshreshtha <email@hidden> wrote:
> When I am trying to add a large file, such as a movie file, then as soon as
> transfer starts (copy or move operation) it invokes directoryDidChange:
> immediately. It did not wait unless the transfer is complete. So I always
> get size as 0.
Yup. The code that’s writing the file creates a new file, which starts empty, then writes data into it as it arrives. If you’re watching for new files, you’ll see the file when it’s created.
> 1. Is there any way to know the complete size of file, which is in transfer
> state. eg. if message displayed is copying 30 MB of 100 MB, I want to get
> 100 MB?
Not at that level. The file will just keep growing until it’s complete.
> 2. Is there any alternative of DirectoryWatcher, which notifies only when
> file is completely added?
You haven’t stated where these files are coming from. Is this a network download? In that case you can use NSURLConnection’s delegate methods to find the size of the file and watch the download progress. If it’s some other API, check whether it has progress monitoring.
—Jens
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden