# Save file when using ionic serve

**URL:** <https://forum.ionicframework.com/t/save-file-when-using-ionic-serve/108466>\
**Category:** ionic-v3\
**Created:** [October 11, 2017, 7:42am UTC](https://forum.ionicframework.com/t/save-file-when-using-ionic-serve/108466 "2017-10-11T07:42:46Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![JAR19](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/jar19/32/113216_2.png) [@JAR19](https://forum.ionicframework.com/u/JAR19)\
**Post date:** [October 11, 2017, 7:42am UTC](https://forum.ionicframework.com/t/save-file-when-using-ionic-serve/108466/1 "2017-10-11T07:42:46Z")

</div>

Is it possible to save data to a local file whilst running ionic serve?

I know there is ionic native file - but that uses cordova.

---

<div class="post-metadata">

**Author:** ![Judgewest2000](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/judgewest2000/32/113339_2.png) [@Judgewest2000](https://forum.ionicframework.com/u/Judgewest2000)\
**Post date:** [October 11, 2017, 7:52am UTC](https://forum.ionicframework.com/t/save-file-when-using-ionic-serve/108466/2 "2017-10-11T07:52:05Z")

</div>

No.

Best you could do is to save the data to local storage.

---

<div class="post-metadata">

**Author:** ![JAR19](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/jar19/32/113216_2.png) [@JAR19](https://forum.ionicframework.com/u/JAR19)\
**Post date:** [October 11, 2017, 8:53am UTC](https://forum.ionicframework.com/t/save-file-when-using-ionic-serve/108466/3 "2017-10-11T08:53:42Z")

</div>

Thanks @Judgewest2000  
I could run a local node server and make http calls to that server and use the node.js fs file system to save the file to disk. It just seems like going around the houses for something which should be straight forward.

---

<div class="post-metadata">

**Author:** ![Judgewest2000](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/judgewest2000/32/113339_2.png) [@Judgewest2000](https://forum.ionicframework.com/u/Judgewest2000)\
**Post date:** [October 11, 2017, 9:04am UTC](https://forum.ionicframework.com/t/save-file-when-using-ionic-serve/108466/4 "2017-10-11T09:04:35Z")

</div>

Honestly - what’s wrong with just saving your data to local storage???

Do you have lots?

---

<div class="post-metadata">

**Author:** ![JAR19](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/jar19/32/113216_2.png) [@JAR19](https://forum.ionicframework.com/u/JAR19)\
**Post date:** [October 11, 2017, 9:18am UTC](https://forum.ionicframework.com/t/save-file-when-using-ionic-serve/108466/5 "2017-10-11T09:18:05Z")

</div>

> [@Judgewest2000](#):
>
> Do you have lots?

Unfortunately that’s the case and it is audio recording - I think it would exceed local storage very quickly (1500 files each file about 50k), plus the bigger problem is how to then transfer the data from the local storage.

I was hoping someone has already used the node.js fs system directly within Ionic.

---

<div class="post-metadata">

**Author:** ![JAR19](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/jar19/32/113216_2.png) [@JAR19](https://forum.ionicframework.com/u/JAR19)\
**Post date:** [October 11, 2017, 9:20am UTC](https://forum.ionicframework.com/t/save-file-when-using-ionic-serve/108466/6 "2017-10-11T09:20:38Z")

</div>

Another possibility is to connect to a local database.

---

<div class="post-metadata">

**Author:** ![Judgewest2000](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/judgewest2000/32/113339_2.png) [@Judgewest2000](https://forum.ionicframework.com/u/Judgewest2000)\
**Post date:** [October 11, 2017, 9:23am UTC](https://forum.ionicframework.com/t/save-file-when-using-ionic-serve/108466/7 "2017-10-11T09:23:49Z")

</div>

That’s 75mb. A lot of local storage sizes max out at 5mb or 10mb whether you do localstorage / indexedb / websql.

You might need a different strategy I’m sorry to say.

---

<div class="post-metadata">

**Author:** ![Sujan12](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sujan12/32/108395_2.png) [@Sujan12](https://forum.ionicframework.com/u/Sujan12)\
**Post date:** [October 11, 2017, 9:32am UTC](https://forum.ionicframework.com/t/save-file-when-using-ionic-serve/108466/8 "2017-10-11T09:32:18Z")

</div>

Why do you need to store 75MB on `ionic serve`? This is not a production webserver but a debugging and development tool. If you want to deploy your Ionic app as a PWA/web app, use a proper HTTP server. But yes, uploading huge amounts of files/data is not supported in web apps - this needs a backend.

---

<div class="post-metadata">

**Author:** ![JAR19](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/jar19/32/113216_2.png) [@JAR19](https://forum.ionicframework.com/u/JAR19)\
**Post date:** [October 11, 2017, 10:31am UTC](https://forum.ionicframework.com/t/save-file-when-using-ionic-serve/108466/9 "2017-10-11T10:31:34Z")

</div>

> [@Sujan12](#):
>
> use a proper HTTP server

You are right a proper server is the way to go.

---

<div class="post-metadata">

**Author:** ![Judgewest2000](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/judgewest2000/32/113339_2.png) [@Judgewest2000](https://forum.ionicframework.com/u/Judgewest2000)\
**Post date:** [October 11, 2017, 10:33am UTC](https://forum.ionicframework.com/t/save-file-when-using-ionic-serve/108466/10 "2017-10-11T10:33:12Z")

</div>

Put those calls into a provider which can do one or the other (save to end point / save to file system) and have it react based on if it’s natively ran or not.
