desktop-application


TideSDK: Download mp3 files


I am trying to download an mp3 file from a server but the app crashes. The file gets created, gets some data in the file and then a crash. Here is what i am trying:
var file = Ti.Filesystem.getFile(directory.nativePath(), filename);
var httpClient = Ti.Network.createHTTPClient();
httpClient.open('GET', URL);
httpClient.receive(function(data) {
var fileStream = Ti.Filesystem.getFileStream(file);
fileStream.open(Ti.Filesystem.MODE_WRITE, true);
fileStream.write(data);
fileStream.close();
});
thanks.
This works:
var file = Ti.Filesystem.getFile(directoryPath, filename);
var httpClient = Ti.Network.createHTTPClient();
httpClient.onload = function(e) {
file.open(Ti.Filesystem.MODE_WRITE);
file.write(this.responseData); // write to the file
}
httpClient.open('GET', URL);
httpClient.send();

Related Links

Is it possible to create new object without URL?
Best JavaScript framework for desktop applications
Appcelerator Titanium Studio 1.0.1: How to show Inspector on OS X Desktop apps?
How do I rotate a single windows application 90 degrees?
What type of programming languages and tools do we need to develop windows desktop application? [closed]
How to manage application data while the application is running? (frequent IO versus more memory usage)
web programming vs software programming [closed]
Self-contained database?
Creating universal binary using XCode 4.0
problem with displaying the form into the center of the screen
Desktop Application using titanium
Cross platform desktop application
Quality checker for PDF to Word conversion process
local web application vs desktop application speed?
How to query user's language choice in innosetup script?
Best way to start desktop application development for a web developer

Categories

HOME
ckan
url
ide
compression
apache-storm
ms-application-insights
snmp
ebay
vsixmanifest
webpack-dev-server
revit-api
soap-client
point-of-sale
yui
tag-cloud
dompdf
k-means
amazon-data-pipeline
aws-devicefarm
url-parameters
datazen-server
combinations
angular2-pipe
waterfall
datanucleus
mongoose-im
proof-general
scripting-language
csproj
ios9
jboss-arquillian
choco
favorites
fastadapter
intersection
cocoa-scripting
repeat
usernotifications
office-interop
ssdp
delphi-xe
android-graphview
directadmin
firefox-developer-edition
rivets.js
stanford-nlp-server
lucee
openidm
business-catalyst
nsalert
scikit-image
access-violation
networkstream
mate-desktop
git-cherry-pick
patching
kik
avi
clear
android-facebook
cyberduck
tooltwist
callfire
pdcurses
waterline
optimistic-locking
tigase
serializer
telerik-appbuilder
traceur
rssi
kernel-density
facebook-java-api
adabas
mysql-error-1146
ia-32
listpicker
typography
pyxplot
azure-scheduler
microsoft-speech-platform
linear-interpolation
nsscrollview
scsf
vectorwise
method-call
auto-compile
fxcopcmd
azure-appfabric
nstoolbar
iphone-maps
carbon-emacs
zend-acl
bootstrap-protocol
content-delivery-network

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App