How to use file system or operation using javascript or Jquery?

别说谁变了你拦得住时间么 提交于 2019-12-19 05:07:25

问题


I want to make some file operation using Javascript or jQuery for Cross Browser like:

File create
File write
File read
Update
Remove/delete

Is it possible to do above stuffs? If possible, from where I can get the idea? Please suggest me.In any end (client/server) how can it be done?i asked this just for know!


回答1:


No you can't do such type of operation on browser.

You need Server Side JavaScript Node.js.

There are lot of details in Filesystem

Write a file example

var fs = require('fs');
fs.writeFile("yourpath", "Hello", function(err) {
    if(err) {
        console.log(err);
    } else {
        console.log("The file was saved!");
    }
}); 



回答2:


No you cannot do this kind of operations on all browsers.

The functionality you are looking for can be accomplished using ActiveX in Internet Explorer only

Html 5's File Api also exist but has many limitations:

Items in one application’s Sandbox are invisible to others.

Items in the Sandbox is invisible to other types of web browsers. For example, a Sandbox created in Google Chrome is invisible to other non-Chrome browsers.

Items in the Sandbox is invisible to non-browser programs.

For more info on this visit this



来源:https://stackoverflow.com/questions/21328689/how-to-use-file-system-or-operation-using-javascript-or-jquery

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!