jsdoc
This commit is contained in:
@@ -0,0 +1,98 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>JSDoc: Source: FileReaderAsync.mjs</title>
|
||||
|
||||
<script src="scripts/prettify/prettify.js"> </script>
|
||||
<script src="scripts/prettify/lang-css.js"> </script>
|
||||
<!--[if lt IE 9]>
|
||||
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||
<![endif]-->
|
||||
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
|
||||
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div id="main">
|
||||
|
||||
<h1 class="page-title">Source: FileReaderAsync.mjs</h1>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<section>
|
||||
<article>
|
||||
<pre class="prettyprint source linenums"><code>/** @module FileReaderAsync */
|
||||
|
||||
/** @class */
|
||||
export class FileReaderAsync {
|
||||
/**
|
||||
* @param {String} type The return type (ArrayBuffer, BinaryString, Text, DataURL)
|
||||
* @param {Blob} blob The `Blob` to read
|
||||
* @returns {Promise<ArrayBuffer>} The `Blob` data
|
||||
*/
|
||||
static readAs(type,blob){
|
||||
return new Promise((resolve,reject)=>{
|
||||
const fileReader=new FileReader()
|
||||
fileReader.onload=(event)=>resolve(event.target.result)
|
||||
fileReader.onabort=(event)=>reject(event)
|
||||
fileReader.onerror=(event)=>reject(event)
|
||||
fileReader['readAs'+type](blob)
|
||||
})
|
||||
}
|
||||
/**
|
||||
* @param {Blob} blob The `Blob` to read
|
||||
* @returns {Promise<ArrayBuffer>} The `Blob` data
|
||||
*/
|
||||
readAsArrayBuffer(blob) {
|
||||
return FileReaderAsync.readAs('ArrayBuffer',blob)
|
||||
}
|
||||
/**
|
||||
* @depreciated see https://developer.mozilla.org/en-US/docs/Web/API/FileReaderSync/readAsBinaryString
|
||||
* @param {Blob} blob The `Blob` to read
|
||||
* @returns {Promise<String>} The `Blob` data
|
||||
*/
|
||||
readAsBinaryString(blob) {
|
||||
return FileReaderAsync.readAs('BinaryString',blob)
|
||||
}
|
||||
/**
|
||||
* @param {Blob} blob The `Blob` to read
|
||||
* @returns {Promise<String>} The `Blob` data
|
||||
*/
|
||||
readAsText(blob) {
|
||||
return FileReaderAsync.readAs('Text',blob)
|
||||
}
|
||||
/**
|
||||
* @param {Blob} blob The `Blob` to read
|
||||
* @returns {Promise<String>} The `Blob` data
|
||||
*/
|
||||
readAsDataURL(blob) {
|
||||
return FileReaderAsync.readAs('DataURL',blob)
|
||||
}
|
||||
}</code></pre>
|
||||
</article>
|
||||
</section>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<nav>
|
||||
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-CSSRandom.html">CSSRandom</a></li><li><a href="module-FileReaderAsync.html">FileReaderAsync</a></li><li><a href="module-FormDataDeep.html">FormDataDeep</a></li></ul><h3>Classes</h3><ul><li><a href="module-FileReaderAsync.FileReaderAsync.html">FileReaderAsync</a></li><li><a href="module-FormDataDeep.FormDataDeep.html">FormDataDeep</a></li></ul>
|
||||
</nav>
|
||||
|
||||
<br class="clear">
|
||||
|
||||
<footer>
|
||||
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 4.0.0</a> on Sat Dec 03 2022 16:41:37 GMT+0000 (Coordinated Universal Time)
|
||||
</footer>
|
||||
|
||||
<script> prettyPrint(); </script>
|
||||
<script src="scripts/linenumber.js"> </script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user