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: Roland King <email@hidden>
- Date: Sat, 16 Nov 2013 08:43:23 +0800
On 16 Nov, 2013, at 8:10 am, Devarshi Kulshreshtha <email@hidden> wrote:
> Hi Jens,
>
> Regarding:
>
> 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.
>
>>> user will be copying these files directly through iTunes.
>
>
Ah .. I do this. I have an NSFilePresenter which is watching a directory. When I get notice there's a new file I (on a queue) perform a coordinated read on it using NSFileCoordinator. The read block only gets called after the file has been completely written. Yes I get multiple callbacks on the file presenter as the file grows, but it doesn't matter, it's very easy to figure out I'm waiting for the coordinated read to occur and throw them away.
I have no idea what the apple sample DirectoryWatcher uses, I rolled my own, but I'm guessing it uses file coordination. I'm getting much in the habit now of thinking, every single time I do any kind of file operation, whether I should use file coordination on it.
_______________________________________________
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