In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-13 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
In this article, the editor introduces in detail "how to use HTML5's FileWriter API". The content is detailed, the steps are clear, and the details are handled properly. I hope this article "how to use HTML5's FileWriter API" can help you solve your doubts.
File API is mainly used to read files, while FileWriter API is used to write files from Web applications. The content of this API is related to File API and Web Worker.
This API mainly includes the following APIs:
blobBuilder interface. Allows the creation of Blog objects from String.
fileSaver interface. It provides a way to write Blog objects to a file and provides an event model to monitor the write process.
fileWriter interface. It extends the fileSaver interface to add richer output options.
fileWriterSync interface. It provides methods to write and modify synchronized files in Web Worker.
Previously, due to security reasons, Web applications are restricted to write files in browsers, and it is very difficult or even impossible to create any type or modify files on disk, but now with FileWriter API, the client can allow applications to write to generated or downloaded files.
The interface defined by File API is used to read files, as well as to manipulate large object data and file access errors. FileWriter API extends this approach by building large object files and using synchronous and asynchronous file write interfaces. Like read operations, writing files on the main thread must be asynchronous to avoid blocking UI operations. Long write operations provide status information through process event delivery.
The following simple function writes a text file through FileWriter:
Function writeFile (writer) {
Function done (evt) {
Alert ("write complete")
}
Function error (evt) {
Alert ("write failed:" + evt)
}
Var bb = new BlobBuilder ()
Bb.append ("New content")
Writer.onwrite = done
Writer.onerror = error
Writer.write (bb.getBlob ())
}
The following is an example of getting and using the fileSaver interface:
Var bb = new BlobBuilder ()
Bb.append ("New content")
Var fileSaver = window.saveAs (bb.getBlob (), "temp.dat")
FileSaver.onwriteend = myOnWriteEnd
After reading this, the article "how to use the FileWriter API of HTML5" has been introduced. If you want to master the knowledge points of this article, you still need to practice and use it yourself. If you want to know more about related articles, welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.