-3

Is there any way to create a file(.txt) in javascript? Can we access the filesystem through javascript. and write the files?

6
  • 1
    JS is client side. Files are server side. Commented Mar 4, 2013 at 13:27
  • 1
    In short: no. Think about what the security implications were if you could. Commented Mar 4, 2013 at 13:28
  • 2
    See stackoverflow.com/questions/7545736/… Commented Mar 4, 2013 at 13:28
  • 2
    What are you trying to achieve? Where are you trying to achieve it? JavaScript is not strictly client-side (node.js), so it really depends on those factors. Without more information, we cannot help. Commented Mar 4, 2013 at 13:29
  • 3
    @itdoesntwork You'd think if the OP was writing in node.js he wouldn't ask this question... :) Commented Mar 4, 2013 at 13:30

2 Answers 2

3

There are experimental HTML5 FileSystem APIs but they are not yet widely supported.

They have some limitations:

If you're calling requestFileSystem() for the first time, new storage is created for your app. It's important to remember that this file system is sandboxed, meaning one web app cannot access another app's files. This also means you cannot read/write files to an arbitrary folder on the user's hard drive (for example My Pictures, My Documents, etc.).

Sign up to request clarification or add additional context in comments.

Comments

-1

Yes, somehow reading file is easy with Javascript FileReader. You can see documentation

4 Comments

This does not allow you to create arbitrary files though.
@deceze have seen the line i have written before giving link of documentation ? I know it can't write files.
Sure, just pointing out that it doesn't answer the question.
@deceze maybe, help a future user. But i think in future HTML gonna be more powerful. We can keep it on desk or you want to say that i need to delete it ?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.