How do I download and save a file locally on iOS using objective C? [duplicate]

I’m not sure what wget is, but to get a file from the web and store it locally, you can use NSData: NSString *stringURL = @”http://www.somewhere.com/thefile.png”; NSURL *url = [NSURL URLWithString:stringURL]; NSData *urlData = [NSData dataWithContentsOfURL:url]; if ( urlData ) { NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *filePath = … Read more

localStorage – use getItem/setItem functions or access object directly?

Not really, they are, basically, exactly the same. One uses encapsulation (getter/setter) to better protect the data and for simple usage. You’re supposed to use this style (for security). The other allows for better usage when names(keys) are unknown and for arrays and loops. Use .key() and .length to iterate through your storage items without … Read more

HTML5 localStorage size limit for subdomains

From http://dev.w3.org/html5/webstorage/#disk-space A mostly arbitrary limit of five megabytes per origin is recommended. Implementation feedback is welcome and will be used to update this suggestion in the future. It also mentions that : User agents should guard against sites storing data under the origins other affiliated sites, e.g. storing up to the limit in a1.example.com, … Read more

Update object stored in chrome extension’s local storage

Extensions can use a database: IndexedDB (the sample code may look convoluted, but it’s pretty simple in the actual extensions, for example two small functions here, getStyles and saveStyle, or IDB-keyval wrapper library). If you want to use chrome.storage, just maintain a global queue array that is populated by the server listener: queue.push(newItem); updateStorage(); and … Read more

Can you use HTML5 local storage to store a file? If not, how?

The FileSystem API[1,2] was going to be your best bet going forward, at one point it was very much bleeding edge. However it has been been abandoned by w3c. From their own documentation: Work on this document has been discontinued and it should not be referenced or used as a basis for implementation. http://dev.w3.org/2009/dap/file-system/pub/FileSystem/ http://www.html5rocks.com/tutorials/file/filesystem/