sails.js: download file in assets directory -


i create .xls file in assets/xls directory :

fs.writefilesync('./assets/xls/data.xls', xls, 'binary'); 

and want download file :

to file url :

var downloadlink = req.headers.host+'/xls/data.xls'; 

i not understant why have 404 error on url :
localhost:1337/xls/data.xls

this isn't recommended practice storing generated or user-uploaded files. assets folder intended site's front-end assets.

if want provide download links in app, you're encouraged save them in separate location , add controller action streams requested file client. allows add policies protect files, , avoids issues source control , grunt. see how authenticate access assets folder in sails.js example of such controller action.


Comments

Popular posts from this blog

How can we post XML strings along with text strings in iOS -

c# - cefsharp app remember password option -

linux - Writing to Embedded Controller registers in Ubuntu 14.04 -