Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Google App Engine allow creation of files and folders on the server?

I know Google App Engine offers free space, but I wonder if it's for storing data in its database only or does it also allow me to create files and directories on the server side to store my data ? For instance can I use the following method to save file ?

  public static void saveFile(String File_Path,StringBuffer Str_Buf,boolean Append)   {     FileOutputStream fos=null;     BufferedOutputStream bos=null;      try     {       fos=new FileOutputStream(File_Path,Append);       bos=new BufferedOutputStream(fos);       for (int j=0;j<Str_Buf.length();j++) bos.write(Str_Buf.charAt(j));     }     catch (Exception e) { e.printStackTrace(); }     finally     {       try        {         if (bos!=null)         {           bos.close();           bos=null;         }         if (fos!=null)         {           fos.close();           fos=null;         }       }       catch (Exception ex) { ex.printStackTrace(); }     }   } 
like image 606
Frank Avatar asked Apr 22 '10 17:04

Frank


People also ask

What is Google App Engine used for?

App Engine is a fully managed, serverless platform for developing and hosting web applications at scale. You can choose from several popular languages, libraries, and frameworks to develop your apps, and then let App Engine take care of provisioning servers and scaling your app instances based on demand.

Does App Engine have storage?

App Engine creates a default bucket when you create an app. This bucket provides the first 5GB of storage for free and includes a free quota for Cloud Storage I/O operations. You can create other Cloud Storage buckets, but only the default bucket includes the first 5GB of storage for free.

Is Google App Engine and Google Cloud same?

GCP App Engine vs Cloud FunctionsWhile App Engine supports many different services within a single application, Cloud Functions support individualized services. It's an important detail when comparing Google App Engine vs Cloud Functions.


1 Answers

You can read files from your own project - You cannot write to the file system

from the FAQ ...

Why can't I write to this file?

Writing to local files is not supported in App Engine due to the distributed nature of your application. Instead, data which must be persisted should be stored in the distributed datastore. For more information see the documentation on the runtime sandbox

An App Engine application cannot:

  • write to the filesystem. Applications must use the App Engine datastore for storing persistent data. Reading from the filesystem is allowed, and all application files uploaded with the application are available.

  • open a socket or access another host directly. An application can use the App Engine URL fetch service to make HTTP and HTTPS requests to other hosts on ports 80 and 443, respectively.

  • spawn a sub-process or thread. A web request to an application must be handled in a single process within a few seconds. Processes that take a very long time to respond are terminated to avoid overloading the web server.

  • make other kinds of system calls.

like image 154
Romain Hippeau Avatar answered Sep 20 '22 21:09

Romain Hippeau